|
|
|
|
|
|
from docopt import docopt |
|
|
|
|
|
|
|
from unitytrainers.trainer_controller import TrainerController |
|
|
|
|
|
|
|
from unitytrainers.exception import TrainerError |
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
print(''' |
|
|
|
|
|
|
--lesson=<n> Start learning from this lesson [default: 0]. |
|
|
|
--load Whether to load the model or randomly initialize [default: False]. |
|
|
|
--run-id=<path> The sub-directory name for model and summary statistics [default: ppo]. |
|
|
|
--num-runs=<n> Number of runs of session [default: 1]. |
|
|
|
--num-runs=<n> Number of concurrent training sessions [default: 1]. |
|
|
|
--save-freq=<n> Frequency at which to save model [default: 50000]. |
|
|
|
--seed=<n> Random seed used for training [default: -1]. |
|
|
|
--slow Whether to run the game at training speed [default: False]. |
|
|
|
|
|
|
base_path = os.path.dirname(__file__) |
|
|
|
TRAINER_CONFIG_PATH = os.path.abspath(os.path.join(base_path, "trainer_config.yaml")) |
|
|
|
|
|
|
|
|
|
|
|
tc = TrainerController(env_path, run_id+"-"+str(sub_id), save_freq, curriculum_file, fast_simulation, |
|
|
|
load_model, train_model, worker_id+sub_id, keep_checkpoints, lesson, seed, |
|
|
|
tc = TrainerController(env_path, run_id + "-" + str(sub_id), save_freq, curriculum_file, fast_simulation, |
|
|
|
load_model, train_model, worker_id + sub_id, keep_checkpoints, lesson, seed, |
|
|
|
|
|
|
|
if env_path is None and num_runs > 1: |
|
|
|
raise TrainerError("It is not possible to launch more than one concurrent training session " |
|
|
|
"when training from the editor") |
|
|
|
jobs = [] |
|
|
|
for i in range(num_runs): |
|
|
|
p = multiprocessing.Process(target=run_training, args=(i,)) |