adjust sweep file to new config structure
This commit is contained in:
1 parent
801dc8ec96
commit
166bd57198
5 files changed
+48
-25
No files matched your search
@@ -1,14 +1,14 @@
|
||||
# THIS FILE SHOULDN't BE EXECUTED DIRECTLY, IT SHOULD BE RUN BY WANDB SWEEP AGENT!
|
||||
import wandb
|
||||
import train
|
||||
|
||||
|
||||
# THIS FILE SHOULDN't BE EXECUTED DIRECTLY, IT SHOULD BE RUN BY WANDB SWEEP AGENT!
|
||||
# Choose which run config to optimize
|
||||
RUN_CONFIG = "MNIST_CLASSIFIER_V1"
|
||||
|
||||
# Load project config
|
||||
conf = train.load_config()
|
||||
|
||||
# Choose model for hyperparameter search
|
||||
model_conf = conf["model_configs"]["simple_mnist_classifier_v1"]
|
||||
project_conf = train.load_config("project_config.yaml")
|
||||
run_conf = train.load_config("run_configs.yaml")[RUN_CONFIG]
|
||||
|
||||
# Initialize wandb
|
||||
wandb.init()
|
||||
@@ -16,8 +16,14 @@ wandb.init()
|
||||
# Replace project config hyperparameters with the ones loaded from wandb sweep server
|
||||
sweep_hparams = wandb.Config._as_dict(wandb.config)
|
||||
for key, value in sweep_hparams.items():
|
||||
if key != "_wandb" and not key.startswith("dataset/"):
|
||||
model_conf[key] = value
|
||||
if key == "_wandb":
|
||||
continue
|
||||
elif key in run_conf["trainer"].keys():
|
||||
run_conf["trainer"][key] = value
|
||||
elif key in run_conf["model"].keys():
|
||||
run_conf["model"][key] = value
|
||||
elif key in run_conf["dataset"].keys():
|
||||
run_conf["dataset"][key] = value
|
||||
|
||||
# Execute run
|
||||
train.train(project_config=conf, run_config=model_conf)
|
||||
train.train(project_config=project_conf, run_config=run_conf)
|
||||
Reference in new issue
Block a user