浏览代码

fix multiple policy issue

/comms-grad
Andrew Cohen 4 年前
当前提交
c72e00c9
共有 2 个文件被更改,包括 14 次插入4 次删除
  1. 5
      ml-agents/mlagents/trainers/ghost/trainer.py
  2. 13
      ml-agents/mlagents/trainers/trainer_controller.py

5
ml-agents/mlagents/trainers/ghost/trainer.py


"""
# Get policy based on team id, but not group id
parsed_behavior_id = BehaviorIdentifiers.from_name_behavior_id(name_behavior_id)
# So that the parsed behavior id is there for new groups
if parsed_behavior_id.behavior_id not in self._name_to_parsed_behavior_id:
self._name_to_parsed_behavior_id[
parsed_behavior_id.behavior_id
] = parsed_behavior_id
name_behavior_id = create_name_behavior_id(
parsed_behavior_id.brain_name, team_id=parsed_behavior_id.team_id
)

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


self.train_model = train
self.param_manager = param_manager
self.ghost_controller = self.trainer_factory.ghost_controller
self.team_ids: List[int] = []
self.registered_behavior_ids: Set[str] = set()
self.trainer_threads: List[threading.Thread] = []

)
self.trainer_threads.append(trainerthread)
policy = trainer.create_policy(
parsed_behavior_id, env_manager.training_behaviors[name_behavior_id]
)
trainer.add_policy(parsed_behavior_id, policy)
if parsed_behavior_id.team_id not in self.team_ids:
policy = trainer.create_policy(
parsed_behavior_id, env_manager.training_behaviors[name_behavior_id]
)
trainer.add_policy(parsed_behavior_id, policy)
self.team_ids.append(parsed_behavior_id.team_id)
else:
policy = trainer.get_policy(name_behavior_id)
agent_manager = AgentManager(
policy,

正在加载...
取消
保存