update execute_sweep.py

This commit is contained in:
hobogalaxy committed 2020-11-24 18:40:50 +01:00
1 parent 8628600ea3
commit 7d09ab8ece
2 files changed
+25 -19

No files matched your search

+22 -19
View File
@@ -1,20 +1,23 @@
# import wandb
# import train
#
#
# # Load project config
# config = train.load_config()
#
# # Initialize wandb
# 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":
# config["hparams"][key] = value
#
# # Execute run
# train.train(config)
import wandb
import train
# TODO: this file
# THIS FILE SHOULDN't BE EXECUTED DIRECTLY, IT SHOULD BE RUN BY WANDB SWEEP AGENT!
# Load project config
conf = train.load_config()
# Choose model for hyperparameter search
model_conf = conf["model_configs"]["simple_mnist_classifier_v1"]
# Initialize wandb
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
# Execute run
train.train(config=conf, model_config=model_conf)