|
|
|
|
|
|
|
|
|
|
import os |
|
|
|
import multiprocessing |
|
|
|
import numpy as np |
|
|
|
|
|
|
|
|
|
|
|
from unitytrainers.trainer_controller import TrainerController |
|
|
|
from unitytrainers.exception import TrainerError |
|
|
|
|
|
|
TRAINER_CONFIG_PATH = os.path.abspath(os.path.join(base_path, "trainer_config.yaml")) |
|
|
|
|
|
|
|
|
|
|
|
def run_training(sub_id): |
|
|
|
def run_training(sub_id, use_seed): |
|
|
|
load_model, train_model, worker_id + sub_id, keep_checkpoints, lesson, seed, |
|
|
|
load_model, train_model, worker_id + sub_id, keep_checkpoints, lesson, use_seed, |
|
|
|
docker_target_name, TRAINER_CONFIG_PATH, no_graphics) |
|
|
|
tc.start_learning() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jobs = [] |
|
|
|
for i in range(num_runs): |
|
|
|
p = multiprocessing.Process(target=run_training, args=(i,)) |
|
|
|
if seed == -1: |
|
|
|
use_seed = np.random.randint(0, 9999) |
|
|
|
else: |
|
|
|
use_seed = seed |
|
|
|
p = multiprocessing.Process(target=run_training, args=(i, use_seed)) |
|
|
|
jobs.append(p) |
|
|
|
p.start() |