diff options
Diffstat (limited to 'src/training/prepare_experiments.py')
-rw-r--r-- | src/training/prepare_experiments.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/training/prepare_experiments.py b/src/training/prepare_experiments.py index eb872d7..5a665b3 100644 --- a/src/training/prepare_experiments.py +++ b/src/training/prepare_experiments.py @@ -1,12 +1,13 @@ """Run a experiment from a config file.""" import json -from subprocess import check_call +from subprocess import run import click from loguru import logger import yaml +# flake8: noqa: S404,S607,S603 def run_experiments(experiments_filename: str) -> None: """Run experiment from file.""" with open(experiments_filename) as f: @@ -15,10 +16,19 @@ def run_experiments(experiments_filename: str) -> None: for index in range(num_experiments): experiment_config = experiments_config["experiments"][index] experiment_config["experiment_group"] = experiments_config["experiment_group"] - # 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)}'" + cmd = f"poetry run run-experiment --gpu=-1 --save --experiment_config={json.dumps(experiment_config)}" print(cmd) - check_call(cmd, shell=True) + run( + [ + "poetry", + "run", + "run-experiment", + "--gpu=-1", + "--save", + f"--experiment_config={json.dumps(experiment_config)}", + ], + check=True, + ) @click.command() |