summaryrefslogtreecommitdiff
path: root/src/training/prepare_experiments.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/training/prepare_experiments.py')
-rw-r--r--src/training/prepare_experiments.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/training/prepare_experiments.py b/src/training/prepare_experiments.py
index 1ab8f00..eb872d7 100644
--- a/src/training/prepare_experiments.py
+++ b/src/training/prepare_experiments.py
@@ -1,22 +1,24 @@
"""Run a experiment from a config file."""
import json
+from subprocess import check_call
import click
from loguru import logger
import yaml
-def run_experiment(experiment_filename: str) -> None:
+def run_experiments(experiments_filename: str) -> None:
"""Run experiment from file."""
- with open(experiment_filename) as f:
+ with open(experiments_filename) as f:
experiments_config = yaml.safe_load(f)
num_experiments = len(experiments_config["experiments"])
for index in range(num_experiments):
experiment_config = experiments_config["experiments"][index]
experiment_config["experiment_group"] = experiments_config["experiment_group"]
- print(
- f"python training/run_experiment.py --gpu=-1 '{json.dumps(experiment_config)}'"
- )
+ # cmd = f"python training/run_experiment.py --gpu=-1 '{json.dumps(experiment_config)}'"
+ cmd = f"poetry run run-experiment --gpu=-1 --save --experiment_config '{json.dumps(experiment_config)}'"
+ print(cmd)
+ check_call(cmd, shell=True)
@click.command()
@@ -26,9 +28,9 @@ def run_experiment(experiment_filename: str) -> None:
type=str,
help="Filename of Yaml file of experiments to run.",
)
-def main(experiment_filename: str) -> None:
+def main(experiments_filename: str) -> None:
"""Parse command-line arguments and run experiments from provided file."""
- run_experiment(experiment_filename)
+ run_experiments(experiments_filename)
if __name__ == "__main__":