浏览代码

Address comments

/develop-generalizationTraining-TrainerController
Arthur Juliani 6 年前
当前提交
e07bfab2
共有 1 个文件被更改,包括 12 次插入6 次删除
  1. 18
      ml-agents/mlagents/trainers/learn.py

18
ml-agents/mlagents/trainers/learn.py


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
正在加载...
取消
保存