Skip to content

Commit

Permalink
Merge pull request #59 from beyretb/dev-v1.0.5
Browse files Browse the repository at this point in the history
Dev v1.0.5
  • Loading branch information
beyretb authored Aug 13, 2019
2 parents 9d5d3f6 + 70ac883 commit 60b5af3
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 24 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,12 @@ features with the agent's frames in order to have frames in line with the config

## Version History

- v1.0.4
- v1.0.5
- Adds customisable resolution during evaluation
- Update `animalai-train` to tf 1.14 to fix `gin` broken dependency
- Release source code for the environment (no support to be provided on this for now)

- Fixes some legacy dependencies and typos in both libraries

- v1.0.3
- Adds inference mode to Gym environment
- Adds seed to Gym Environment
Expand Down
2 changes: 1 addition & 1 deletion animalai/animalai/envs/gym/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self,
arenas_configurations=arenas_configurations,
inference=inference,
resolution=resolution)
# self.name = self._env.academy_name
self.name = 'aaio'
self.vector_obs = None
self.inference = inference
self.resolution = resolution
Expand Down
2 changes: 1 addition & 1 deletion animalai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='animalai',
version='1.0.3',
version='1.0.5',
description='Animal AI competition interface',
url='https://github.com/beyretb/AnimalAI-Olympics',
author='Benjamin Beyret',
Expand Down
12 changes: 5 additions & 7 deletions examples/animalai_train/animalai_train/trainers/curriculum.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@


class Curriculum(object):
def __init__(self, location, default_reset_parameters):
def __init__(self, location):
"""
Initializes a Curriculum object.
:param location: Path to JSON defining curriculum.
:param default_reset_parameters: Set of reset parameters for
environment.
"""
self.max_lesson_num = 0
self.measure = None
Expand Down Expand Up @@ -47,10 +45,10 @@ def __init__(self, location, default_reset_parameters):

parameters = self.data['parameters']
for key in parameters:
if key not in default_reset_parameters:
raise CurriculumError(
'The parameter {0} in Curriculum {1} is not present in '
'the Environment'.format(key, location))
# if key not in default_reset_parameters:
# raise CurriculumError(
# 'The parameter {0} in Curriculum {1} is not present in '
# 'the Environment'.format(key, location))
if len(parameters[key]) != self.max_lesson_num + 1:
raise CurriculumError(
'The parameter {0} in Curriculum {1} must have {2} values '
Expand Down
5 changes: 2 additions & 3 deletions examples/animalai_train/animalai_train/trainers/learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def try_create_meta_curriculum(curriculum_folder: Optional[str], env: UnityEnvir
if curriculum_folder is None:
return None
else:
meta_curriculum = MetaCurriculum(curriculum_folder, env._resetParameters)
meta_curriculum = MetaCurriculum(curriculum_folder)
if meta_curriculum:
for brain_name in meta_curriculum.brains_to_curriculums.keys():
if brain_name not in env.external_brain_names:
Expand Down Expand Up @@ -167,8 +167,7 @@ def init_environment(env_path, docker_target_name, no_graphics, worker_id, fast_
file_name=env_path,
worker_id=worker_id,
seed=seed,
docker_training=docker_training,
no_graphics=no_graphics
docker_training=docker_training
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ class MetaCurriculum(object):
particular brain in the environment.
"""

def __init__(self, curriculum_folder, default_reset_parameters):
def __init__(self, curriculum_folder):
"""Initializes a MetaCurriculum object.
Args:
curriculum_folder (str): The relative or absolute path of the
folder which holds the curriculums for this environment.
The folder should contain JSON files whose names are the
brains that the curriculums belong to.
default_reset_parameters (dict): The default reset parameters
of the environment.
"""
used_reset_parameters = set()
self._brains_to_curriculums = {}
Expand All @@ -33,8 +31,7 @@ def __init__(self, curriculum_folder, default_reset_parameters):
brain_name = curriculum_filename.split('.')[0]
curriculum_filepath = \
os.path.join(curriculum_folder, curriculum_filename)
curriculum = Curriculum(curriculum_filepath,
default_reset_parameters)
curriculum = Curriculum(curriculum_filepath)

# Check if any two curriculums use the same reset params.
if any([(parameter in curriculum.get_config().keys())
Expand Down
5 changes: 3 additions & 2 deletions examples/animalai_train/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='animalai_train',
version='1.0.4',
version='1.0.5',
description='Animal AI competition training library',
url='https://github.com/beyretb/AnimalAI-Olympics',
author='Benjamin Beyret',
Expand All @@ -20,7 +20,7 @@
zip_safe=False,

install_requires=[
'animalai>=1.0.3',
'animalai>=1.0.5',
'dopamine-rl',
'tensorflow==1.14',
'matplotlib',
Expand All @@ -31,6 +31,7 @@
'pyyaml>=5.1',
'atari-py',
'jsonpickle>=1.2',
'docopt',
'pypiwin32==223;platform_system=="Windows"'],
python_requires=">=3.5,<3.8",
)
8 changes: 5 additions & 3 deletions examples/submission/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ def reset(self, t=250):

def step(self, obs, reward, done, info):
"""
A single step the agent should take based on the current
:param brain_info: a single BrainInfo containing the observations and reward for a single step for one agent
:return: a list of actions to execute (of size 2)
:param obs: agent's observation of the current environment
:param reward: amount of reward returned after previous action
:param done: whether the episode has ended.
:param info: contains auxiliary diagnostic information, including BrainInfo.
:return: the action to take, a list or size 2
"""

brain_info = info['brain_info']
Expand Down

0 comments on commit 60b5af3

Please sign in to comment.