Unverified Commit 2d5155da authored by Benjamin Beyret's avatar Benjamin Beyret Committed by GitHub
Browse files

merge Dev v1.1.0 - curriculum with yaml files

Dev v1.1.0
parents 6ebfa72e 5fe24394
!ArenaConfig
arenas:
0: !Arena
t: 500
items:
- !Item
name: Wall
positions:
- !Vector3 {x: -1, y: 0, z: 10}
- !Vector3 {x: -1, y: 0, z: 20}
- !Vector3 {x: -1, y: 0, z: 30}
- !Vector3 {x: 10, y: 0, z: -1}
- !Vector3 {x: 20, y: 0, z: -1}
colors:
rotations: [90,90,90,0,0]
sizes:
- !Vector3 {x: 1, y: 5, z: 9}
- !Vector3 {x: 1, y: 5, z: 9}
- !Vector3 {x: 1, y: 5, z: 9}
- !Vector3 {x: 1, y: 5, z: 9}
- !Vector3 {x: 1, y: 5, z: 9}
- !Item
name: GoodGoal
positions:
- !Vector3 {x: -1, y: 0, z: 35}
sizes:
- !Vector3 {x: 2, y: 2, z: 2}
- !Item
name: Agent
positions:
- !Vector3 {x: -1, y: 1, z: 5}
\ No newline at end of file
!ArenaConfig
arenas:
0: !Arena
t: 500
items:
- !Item
name: Wall
positions:
- !Vector3 {x: -1, y: 0, z: 10}
- !Vector3 {x: -1, y: 0, z: 20}
- !Vector3 {x: -1, y: 0, z: 30}
- !Vector3 {x: 10, y: 0, z: -1}
- !Vector3 {x: 20, y: 0, z: -1}
- !Vector3 {x: 30, y: 0, z: -1}
colors:
rotations: [90,90,90,0,0,0]
sizes:
- !Vector3 {x: 1, y: 5, z: 9}
- !Vector3 {x: 1, y: 5, z: 9}
- !Vector3 {x: 1, y: 5, z: 9}
- !Vector3 {x: 1, y: 5, z: 9}
- !Vector3 {x: 1, y: 5, z: 9}
- !Vector3 {x: 1, y: 5, z: 9}
- !Item
name: GoodGoal
positions:
- !Vector3 {x: -1, y: 0, z: 35}
sizes:
- !Vector3 {x: 2, y: 2, z: 2}
- !Item
name: Agent
positions:
- !Vector3 {x: -1, y: 1, z: 5}
\ No newline at end of file
{
"measure": "reward",
"thresholds": [
1.5,
1.4,
1.3,
1.2,
1.1
],
"min_lesson_length": 100,
"signal_smoothing": true,
"configuration_files": [
"0.yaml",
"1.yaml",
"2.yaml",
"3.yaml",
"4.yaml",
"5.yaml"
]
}
\ No newline at end of file
from animalai_train.trainers.trainer_controller import TrainerController
from animalai.envs import UnityEnvironment
from animalai_train.trainers.meta_curriculum import MetaCurriculum
import random
import yaml
import sys
# ML-agents parameters for training
env_path = '../env/AnimalAI'
worker_id = random.randint(1, 100)
seed = 10
base_port = 5005
sub_id = 1
run_id = 'train_example_curriculum'
save_freq = 5000
curriculum_file = 'configs/curriculum/'
load_model = False
train_model = True
keep_checkpoints = 5000
lesson = 0
run_seed = 1
trainer_config_path = 'configs/trainer_config.yaml'
model_path = './models/{run_id}'.format(run_id=run_id)
summaries_dir = './summaries'
maybe_meta_curriculum = MetaCurriculum(curriculum_file)
trainer_config = yaml.load(open(trainer_config_path))
env = UnityEnvironment(
n_arenas=1, # Change this to train on more arenas
file_name=env_path,
worker_id=worker_id,
seed=seed,
docker_training=False,
play=False
)
external_brains = {brain: env.brains[brain] for brain in env.external_brain_names}
tc = TrainerController(model_path, summaries_dir, run_id + '-' + str(sub_id),
save_freq, maybe_meta_curriculum,
load_model, train_model,
keep_checkpoints, lesson, external_brains, run_seed)
tc.start_learning(env, trainer_config)
......@@ -22,7 +22,6 @@ keep_checkpoints = 5000
lesson = 0
run_seed = 1
docker_target_name = None
no_graphics = False
trainer_config_path = 'configs/trainer_config.yaml'
model_path = './models/{run_id}'.format(run_id=run_id)
summaries_dir = './summaries'
......@@ -44,7 +43,7 @@ def load_config(trainer_config_path):
.format(trainer_config_path))
def init_environment(env_path, docker_target_name, no_graphics, worker_id, seed):
def init_environment(env_path, docker_target_name, worker_id, seed):
if env_path is not None:
# Strip out executable extensions if passed
env_path = (env_path.strip()
......@@ -71,7 +70,7 @@ else:
arena_config_in = ArenaConfig('configs/exampleTraining.yaml')
trainer_config = load_config(trainer_config_path)
env = init_environment(env_path, docker_target_name, no_graphics, worker_id, run_seed)
env = init_environment(env_path, docker_target_name, worker_id, run_seed)
external_brains = {}
for brain_name in env.external_brain_names:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment