File size: 1,503 Bytes
b20c769
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# import json
# import unittest

# from src.data.config import NORMALIZATION_DICT_FILENAME
# from src.data.dataset import Normalizer
# from src.galileo import Encoder
# from src.utils import check_config, config_dir, load_check_config


# class TestConfigs(unittest.TestCase):
#     @staticmethod
#     def check_models_can_be_loaded(config):
#         _ = Encoder(**config["model"]["encoder"])

#     def test_configs(self):
#         configs = list((config_dir / "mae").glob("*.json"))

#         for config_path in configs:
#             try:
#                 loaded_config = load_check_config(config_path.name)
#                 self.check_models_can_be_loaded(loaded_config)
#             except Exception as e:
#                 print(f"Failed for {config_path} with {e}")
#                 raise e

#     def test_normalization_dict(self):
#         if (config_dir / NORMALIZATION_DICT_FILENAME).exists():
#             with (config_dir / NORMALIZATION_DICT_FILENAME).open("r") as f:
#                 norm_dict = json.load(f)
#         output_dict = {}
#         for key, val in norm_dict.items():
#             if "n" not in key:
#                 output_dict[int(key)] = val
#             else:
#                 output_dict[key] = val
#         normalizer = Normalizer(std=True, normalizing_dicts=output_dict)
#         for key, val in normalizer.shift_div_dict.items():
#             divs = val["div"]
#             for d in divs:
#                 self.assertNotEqual(d, 0, f"0 in {key}")