Spaces:
Sleeping
Sleeping
File size: 1,026 Bytes
e11e4fe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import argparse
from typing import Optional, List
from mlagents.trainers.learn import run_cli
from mlagents.trainers.settings import RunOptions
from mlagents.trainers.cli_utils import load_config
from mlagents.plugins.trainer_type import register_trainer_plugins
def parse_command_line(argv: Optional[List[str]] = None) -> argparse.Namespace:
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument("experiment_config_path")
return parser.parse_args(argv)
def main():
"""
Provides an alternative CLI interface to mlagents-learn, 'mlagents-run-experiment'.
Accepts a JSON/YAML formatted mlagents.trainers.learn.RunOptions object, and executes
the run loop as defined in mlagents.trainers.learn.run_cli.
"""
args = parse_command_line()
expt_config = load_config(args.experiment_config_path)
_, _ = register_trainer_plugins()
run_cli(RunOptions.from_dict(expt_config))
if __name__ == "__main__":
main()
|