|
|
|
|
|
|
from .exception import TrainerError |
|
|
|
|
|
|
|
|
|
|
|
def run_training(sub_id, run_seed, run_options, q): |
|
|
|
def run_training(sub_id, run_seed, run_options, process_queue): |
|
|
|
:param process_queue: Queue used to send signal back to main. |
|
|
|
:param sub_id: Unique id for training session. |
|
|
|
:param run_seed: Random seed used for training. |
|
|
|
:param run_options: Command line arguments for training. |
|
|
|
|
|
|
no_graphics = run_options['--no-graphics'] |
|
|
|
trainer_config_path = run_options['<trainer-config-path>'] |
|
|
|
|
|
|
|
# Create controller and begin training. |
|
|
|
# Create controller and launch environment. |
|
|
|
q.put(True) |
|
|
|
|
|
|
|
# Signal that environment has been launched. |
|
|
|
process_queue.put(True) |
|
|
|
|
|
|
|
# Begin training |
|
|
|
tc.start_learning() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i in range(num_runs): |
|
|
|
if seed == -1: |
|
|
|
run_seed = np.random.randint(0, 10000) |
|
|
|
q = Queue() |
|
|
|
p = Process(target=run_training, args=(i, run_seed, options, q)) |
|
|
|
process_queue = Queue() |
|
|
|
p = Process(target=run_training, args=(i, run_seed, options, process_queue)) |
|
|
|
while q.get() is not True: |
|
|
|
# Wait for signal that environment has successfully launched |
|
|
|
while process_queue.get() is not True: |
|
|
|
continue |