diff options
author | aktersnurra <gustaf.rydholm@gmail.com> | 2020-07-22 23:18:08 +0200 |
---|---|---|
committer | aktersnurra <gustaf.rydholm@gmail.com> | 2020-07-22 23:18:08 +0200 |
commit | f473456c19558aaf8552df97a51d4e18cc69dfa8 (patch) | |
tree | 0d35ce2410ff623ba5fb433d616d95b67ecf7a98 /src/training/prepare_experiments.py | |
parent | ad3bd52530f4800d4fb05dfef3354921f95513af (diff) |
Working training loop and testing of trained CharacterModel.
Diffstat (limited to 'src/training/prepare_experiments.py')
-rw-r--r-- | src/training/prepare_experiments.py | 16 |
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__": |