|
30 | 30 | else: |
31 | 31 | devices.append('cpu') |
32 | 32 |
|
33 | | - max_jobs_per_device = 10 |
| 33 | + max_jobs_per_device = 12 |
34 | 34 | n_worker = n_device * max_jobs_per_device |
35 | 35 |
|
36 | 36 | print("DEVICES", devices) |
|
44 | 44 | "context_size": 200, |
45 | 45 | "batch_size": 256, |
46 | 46 | "n_epoch": n_epoch, |
47 | | - "learning_rate": 5e-4, |
48 | | - "weight_decay": 5e-5, |
49 | 47 | "accumulation_steps": 1, |
50 | 48 | "state_dimensions": [0], |
51 | | - "optimizer_class": AdamW, |
52 | 49 | "device": devices, |
53 | 50 | "state_control": "periodic", |
54 | 51 | "discover_state": True, |
55 | 52 | "sensorial_train_losses": [Dimensions.MEASUREMENT], |
56 | | - "state_size": 128, |
57 | | - "positional_encoder_type": "alibi", |
58 | | - "n_attention_head": 4, |
59 | 53 | } |
60 | 54 |
|
61 | 55 | n_variation = 0 |
|
78 | 72 | recall_n_past_choices = [5, 1, 0] |
79 | 73 | recall_stride_choices = [3, 1] |
80 | 74 |
|
81 | | - for recall_stride in recall_stride_choices: |
82 | | - for recall_n_past in recall_n_past_choices: |
83 | | - |
84 | | - recall_n_future_choices = [0] |
85 | | - if len(short_time_recall) > 0 and recall_n_past > 0: |
86 | | - recall_n_future_choices = [5, 1, 0] |
87 | | - elif len(short_time_recall) > 0: |
88 | | - recall_n_future_choices = [5, 1] |
89 | | - |
90 | | - for recall_n_future in recall_n_future_choices: |
91 | | - for positional_encoder_type in ["alibi"]: |
92 | | - for block_configuration in [[Dimensions.MEASUREMENT, Dimensions.MEASUREMENT], |
93 | | - [Dimensions.MEASUREMENT, Dimensions.STATE_INPUT]]: |
94 | | - for state_activation in ["tanh", None]: |
95 | | - state_regularizer = None |
96 | | - if state_activation is None: |
97 | | - state_regularizer = "mse" |
98 | | - |
99 | | - for train_mse in [True]: |
100 | | - for train_stdw in [False]: |
101 | | - for noise_config in [None, |
102 | | - {"state": { |
103 | | - "mean": 0.0, "std": 0.1}}, |
104 | | - {"measurement": { |
105 | | - "mean": 0.0, "std": 0.1}}, |
106 | | - {"state": {"mean": 0.0, "std": 0.1}, "measurement": {"mean": 0.0, "std": 0.1}}]: |
107 | | - |
108 | | - n_variation += 1 |
109 | | - |
110 | | - config = {"n_segment": n_segment, |
111 | | - "fast_forward": fast_forward, |
112 | | - "stable_state_epochs": stable_state_epochs, |
113 | | - "check_input_masks": check_input_masks, |
114 | | - "state_save_method": state_save_method, |
115 | | - "mask_sensorial_data": mask_sensorial_data, |
116 | | - "short_time_recall": short_time_recall, |
117 | | - "recall_stride_past": recall_stride, |
118 | | - "recall_stride_future": recall_stride, |
119 | | - "recall_n_past": recall_n_past, |
120 | | - "recall_n_future": recall_n_future, |
121 | | - "positional_encoder_type": positional_encoder_type, |
122 | | - "block_configuration": block_configuration, |
123 | | - "state_activation": state_activation, |
124 | | - "state_regularizer": state_regularizer, |
125 | | - "train_mse": train_mse, |
126 | | - "train_sdtw": train_stdw, |
127 | | - "noise_config": noise_config} |
128 | | - |
129 | | - model = make_model( |
130 | | - config, "ParametersModel").model_validate(config) |
131 | | - model_json = model.model_dump_json() |
132 | | - variation_hash = int( |
133 | | - hashlib.md5(model_json.encode('utf-8')).hexdigest(), 16) |
134 | | - |
135 | | - configurations["variation"+str( |
136 | | - variation_hash)] = config |
| 75 | + for recall_stride_past in recall_stride_choices: |
| 76 | + for recall_stride_future in recall_stride_choices: |
| 77 | + for recall_n_past in recall_n_past_choices: |
| 78 | + |
| 79 | + recall_n_future_choices = [0] |
| 80 | + if len(short_time_recall) > 0 and recall_n_past > 0: |
| 81 | + recall_n_future_choices = [ |
| 82 | + 5, 1, 0] |
| 83 | + elif len(short_time_recall) > 0: |
| 84 | + recall_n_future_choices = [ |
| 85 | + 5, 1] |
| 86 | + |
| 87 | + for recall_n_future in recall_n_future_choices: |
| 88 | + for positional_encoder_type in ["alibi"]: |
| 89 | + for block_configuration in [[Dimensions.MEASUREMENT, Dimensions.MEASUREMENT], |
| 90 | + [Dimensions.MEASUREMENT, Dimensions.STATE_INPUT]]: |
| 91 | + for state_activation in ["tanh", None]: |
| 92 | + state_regularizer = None |
| 93 | + if state_activation is None: |
| 94 | + state_regularizer = "mse" |
| 95 | + |
| 96 | + for train_mse in [True]: |
| 97 | + for train_stdw in [False]: |
| 98 | + for noise_config in [None, |
| 99 | + {"state": { |
| 100 | + "mean": 0.0, "std": 0.1}}, |
| 101 | + {"measurement": { |
| 102 | + "mean": 0.0, "std": 0.1}}, |
| 103 | + {"state": {"mean": 0.0, "std": 0.1}, "measurement": {"mean": 0.0, "std": 0.1}}]: |
| 104 | + for local_chance in [None, 0.25]: |
| 105 | + n_variation += 1 |
| 106 | + |
| 107 | + config = {"n_segment": n_segment, |
| 108 | + "fast_forward": fast_forward, |
| 109 | + "stable_state_epochs": stable_state_epochs, |
| 110 | + "check_input_masks": check_input_masks, |
| 111 | + "state_save_method": state_save_method, |
| 112 | + "mask_sensorial_data": mask_sensorial_data, |
| 113 | + "short_time_recall": short_time_recall, |
| 114 | + "recall_stride_past": recall_stride_past, |
| 115 | + "recall_stride_future": recall_stride_future, |
| 116 | + "recall_n_past": recall_n_past, |
| 117 | + "recall_n_future": recall_n_future, |
| 118 | + "positional_encoder_type": positional_encoder_type, |
| 119 | + "block_configuration": block_configuration, |
| 120 | + "state_activation": state_activation, |
| 121 | + "state_regularizer": state_regularizer, |
| 122 | + "train_mse": train_mse, |
| 123 | + "train_sdtw": train_stdw, |
| 124 | + "noise_config": noise_config, |
| 125 | + "local_chance": local_chance, |
| 126 | + |
| 127 | + # Fixed |
| 128 | + "batch_size": 256, |
| 129 | + "learning_rate": 1e-3, |
| 130 | + "cosine_annealing": True, |
| 131 | + "cosine_annealing_T_mult": 1, |
| 132 | + "cosine_annealing_T0": 25, |
| 133 | + "weight_decay": 5e-5, |
| 134 | + "optimizer_class": AdamW, |
| 135 | + "state_size": 128, |
| 136 | + "n_attention_head": 4} |
| 137 | + |
| 138 | + model = make_model( |
| 139 | + config, "ParametersModel").model_validate(config) |
| 140 | + model_json = model.model_dump_json() |
| 141 | + variation_hash = int( |
| 142 | + hashlib.md5(model_json.encode('utf-8')).hexdigest(), 16) |
| 143 | + |
| 144 | + configurations["variation"+str( |
| 145 | + variation_hash)] = config |
137 | 146 |
|
138 | 147 | assert len(configurations) == n_variation |
139 | 148 |
|
| 149 | + print(f"Running {n_variation} variations") |
| 150 | + |
140 | 151 | os.makedirs(output_dir, exist_ok=True) |
141 | 152 | configurations_path = os.path.join(output_dir, "configurations.bin") |
142 | 153 | with open(configurations_path, "wb") as file: |
|
0 commit comments