|
|
|
|
|
|
import yaml |
|
|
|
|
|
|
|
from mlagents.trainers.ghost.trainer import GhostTrainer |
|
|
|
from mlagents.trainers.ghost.controller import GhostController |
|
|
|
from mlagents.trainers.behavior_id_utils import BehaviorIdentifiers |
|
|
|
from mlagents.trainers.behavior_id_utils import BehaviorIdentifiers |
|
|
|
from mlagents.trainers.tests import mock_brain as mb |
|
|
|
from mlagents.trainers.tests.test_trajectory import make_fake_trajectory |
|
|
|
|
|
|
|
|
|
|
dummy_config["summary_path"] = "./summaries/test_trainer_summary" |
|
|
|
dummy_config["model_path"] = "./models/test_trainer_models/TestModel" |
|
|
|
ppo_trainer = PPOTrainer(brain_name, 0, dummy_config, True, False, 0, "0") |
|
|
|
trainer = GhostTrainer(ppo_trainer, brain_name, 0, dummy_config, True, "0") |
|
|
|
controller = GhostController(100) |
|
|
|
trainer = GhostTrainer( |
|
|
|
ppo_trainer, brain_name, controller, 0, dummy_config, True, "0" |
|
|
|
) |
|
|
|
trainer.add_policy(brain_params_team0.brain_name, policy) |
|
|
|
parsed_behavior_id0 = BehaviorIdentifiers.from_name_behavior_id( |
|
|
|
brain_params_team0.brain_name |
|
|
|
) |
|
|
|
trainer.add_policy(parsed_behavior_id0, policy) |
|
|
|
trainer.add_policy(brain_params_team1.brain_name, policy) |
|
|
|
parsed_behavior_id1 = BehaviorIdentifiers.from_name_behavior_id( |
|
|
|
brain_params_team1.brain_name |
|
|
|
) |
|
|
|
trainer.add_policy(parsed_behavior_id1, policy) |
|
|
|
trajectory_queue1 = AgentManagerQueue(brain_params_team1.brain_name) |
|
|
|
trainer.subscribe_trajectory_queue(trajectory_queue1) |
|
|
|
|
|
|
|
|
|
|
vector_action_space_type=0, |
|
|
|
) |
|
|
|
|
|
|
|
brain_name = BehaviorIdentifiers.from_name_behavior_id( |
|
|
|
parsed_behavior_id0 = BehaviorIdentifiers.from_name_behavior_id( |
|
|
|
).brain_name |
|
|
|
) |
|
|
|
|
|
|
|
brain_name = parsed_behavior_id0.brain_name |
|
|
|
|
|
|
|
brain_params_team1 = BrainParameters( |
|
|
|
brain_name="test_brain?team=1", |
|
|
|
|
|
|
dummy_config["summary_path"] = "./summaries/test_trainer_summary" |
|
|
|
dummy_config["model_path"] = "./models/test_trainer_models/TestModel" |
|
|
|
ppo_trainer = PPOTrainer(brain_name, 0, dummy_config, True, False, 0, "0") |
|
|
|
trainer = GhostTrainer(ppo_trainer, brain_name, 0, dummy_config, True, "0") |
|
|
|
controller = GhostController(100) |
|
|
|
trainer = GhostTrainer( |
|
|
|
ppo_trainer, brain_name, controller, 0, dummy_config, True, "0" |
|
|
|
) |
|
|
|
trainer.add_policy(brain_params_team0.brain_name, policy) |
|
|
|
trainer.add_policy(parsed_behavior_id0, policy) |
|
|
|
trainer.add_policy(brain_params_team1.brain_name, policy) |
|
|
|
parsed_behavior_id1 = BehaviorIdentifiers.from_name_behavior_id( |
|
|
|
brain_params_team1.brain_name |
|
|
|
) |
|
|
|
trainer.add_policy(parsed_behavior_id1, policy) |
|
|
|
policy_queue1 = AgentManagerQueue(brain_params_team1.brain_name) |
|
|
|
trainer.publish_policy_queue(policy_queue1) |
|
|
|
|
|
|
|