Unverified Commit 60b5af39 authored by Benjamin Beyret's avatar Benjamin Beyret Committed by GitHub
Browse files

Merge pull request #59 from beyretb/dev-v1.0.5

Dev v1.0.5
parents 9d5d3f6d 70ac883c
......@@ -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
......
......@@ -56,7 +56,7 @@ class AnimalAIEnv(gym.Env):
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
......
......@@ -2,7 +2,7 @@ from setuptools import setup
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',
......
......@@ -10,12 +10,10 @@ logger = logging.getLogger('mlagents.trainers')
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
......@@ -47,10 +45,10 @@ class Curriculum(object):
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 '
......
......@@ -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:
......@@ -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
)
......
......@@ -14,7 +14,7 @@ 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:
......@@ -22,8 +22,6 @@ class MetaCurriculum(object):
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 = {}
......@@ -33,8 +31,7 @@ class MetaCurriculum(object):
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())
......
......@@ -2,7 +2,7 @@ from setuptools import setup
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',
......@@ -20,7 +20,7 @@ setup(
zip_safe=False,
install_requires=[
'animalai>=1.0.3',
'animalai>=1.0.5',
'dopamine-rl',
'tensorflow==1.14',
'matplotlib',
......@@ -31,6 +31,7 @@ setup(
'pyyaml>=5.1',
'atari-py',
'jsonpickle>=1.2',
'docopt',
'pypiwin32==223;platform_system=="Windows"'],
python_requires=">=3.5,<3.8",
)
......@@ -46,9 +46,11 @@ class Agent(object):
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']
......
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