浏览代码

Only using multiprocess when --num-runs>1 (#1583)

Fixes the bug of the models not being saved in docker
/hotfix-v0.9.2a
GitHub 6 年前
当前提交
3523f9be
共有 1 个文件被更改,包括 14 次插入8 次删除
  1. 22
      ml-agents/mlagents/trainers/learn.py

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


jobs = []
run_seed = seed
for i in range(num_runs):
if num_runs == 1:
process_queue = Queue()
p = Process(target=run_training, args=(i, run_seed, options, process_queue))
jobs.append(p)
p.start()
# Wait for signal that environment has successfully launched
while process_queue.get() is not True:
continue
run_training(0, run_seed, options, Queue())
else:
for i in range(num_runs):
if seed == -1:
run_seed = np.random.randint(0, 10000)
process_queue = Queue()
p = Process(target=run_training, args=(i, run_seed, options, process_queue))
jobs.append(p)
p.start()
# Wait for signal that environment has successfully launched
while process_queue.get() is not True:
continue
# For python debugger to directly run this script
if __name__ == "__main__":
正在加载...
取消
保存