浏览代码

Fix stall in ghost trainer non-threaded

/develop/dockerfile
Ervin Teng 5 年前
当前提交
392fcb4e
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 6
      ml-agents/mlagents/trainers/agent_processor.py
  2. 1
      ml-agents/mlagents/trainers/trainer_controller.py

6
ml-agents/mlagents/trainers/agent_processor.py


pass
def __init__(self, behavior_id: str, maxlen: int = 20):
def __init__(self, behavior_id: str, maxlen: int = 0):
"""
Initializes an AgentManagerQueue. Note that we can give it a behavior_id so that it can be identified
separately from an AgentManager.

behavior_id: str,
stats_reporter: StatsReporter,
max_trajectory_length: int = sys.maxsize,
threaded: bool = True,
trajectory_queue_len = 20 if threaded else 0
self.behavior_id
self.behavior_id, maxlen=trajectory_queue_len
)
# NOTE: we make policy queues of infinite length to avoid lockups of the trainers.
# In the environment manager, we make sure to empty the policy queue before continuing to produce steps.

1
ml-agents/mlagents/trainers/trainer_controller.py


name_behavior_id,
trainer.stats_reporter,
trainer.parameters.get("time_horizon", sys.maxsize),
threaded=trainer.threaded,
)
env_manager.set_agent_manager(name_behavior_id, agent_manager)
env_manager.set_policy(name_behavior_id, policy)

正在加载...
取消
保存