Skip to content

Commit

Permalink
fix the sweep logic
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian committed Dec 21, 2024
1 parent 84fdfae commit c43b524
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/axolotl/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,22 @@ def generate_sweep_configs(base_config, sweeps_config):
for reg_combo in regular_combinations:
if paired_values:
for paired_set in paired_values:
new_config = {}
# new_config = deepcopy(base_config)
# Combine regular parameters with paired parameters
full_combo = {**dict(zip(param_names, reg_combo)), **paired_set}
all_combinations.append(full_combo)
for param_name, param_value in full_combo.items():
new_config[param_name] = param_value
print(new_config)
all_combinations.append(new_config)
else:
# If no paired values, just use regular combinations
all_combinations.append(dict(zip(param_names, reg_combo)))
# new_config = deepcopy(base_config)
new_config = {}
for param_name, param_value in zip(param_names, reg_combo):
new_config[param_name] = param_value
print(new_config)
all_combinations.append(new_config)

# randomize the order of trials
random.seed(42)
Expand All @@ -77,7 +87,7 @@ def generate_sweep_configs(base_config, sweeps_config):
result_configs = []
for combination in all_combinations:
new_config = deepcopy(base_config)
for param_name, param_value in zip(param_names, combination):
for param_name, param_value in combination.items():
new_config[param_name] = param_value
result_configs.append(new_config)

Expand Down

0 comments on commit c43b524

Please sign in to comment.