Skip to content

Refactor of Curriculum and parameter sampling #4160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ca71d18
Introduced the Constant Parameter Sampler that will be useful later a…
vincentpierre Jun 22, 2020
6bb7296
Refactored the settings.py to refect the new format of the config.yaml
vincentpierre Jun 22, 2020
bced262
First working version
vincentpierre Jun 24, 2020
99297b9
Added the unit tests
vincentpierre Jun 24, 2020
2d7feac
Update to Upgrade for Updates
vincentpierre Jun 24, 2020
e3a14b2
fixing the tests
vincentpierre Jun 24, 2020
e33996b
Upgraded the config files
vincentpierre Jun 24, 2020
c9b0214
Fixes
vincentpierre Jun 24, 2020
b1e01ad
Additional error catching
vincentpierre Jun 25, 2020
13d52a0
addressing some comments
vincentpierre Jun 25, 2020
e25e7f1
Making the code nicer with cattr
vincentpierre Jun 25, 2020
b0cb4e7
Added and registered an unstructure hook for PrameterRandomization
vincentpierre Jun 26, 2020
ae70965
Updating C# Walljump
vincentpierre Jun 26, 2020
6f66a7e
Adding comments
vincentpierre Jun 26, 2020
4a3c4f0
Add test for settings export (#4164)
Jun 26, 2020
690d7b7
Merge branch 'develop-env-param-refactor' of https://github.com/Unity…
vincentpierre Jun 26, 2020
a10a4e3
Including environment parameters for the test for settings export
vincentpierre Jun 26, 2020
699496e
First documentation update
vincentpierre Jun 26, 2020
3755bc5
Fixing a link
vincentpierre Jun 26, 2020
84786ce
Updating changelog and migrating
vincentpierre Jun 26, 2020
0976352
adding some more tests for the conversion script
vincentpierre Jun 29, 2020
09851ee
fixing bugs and using samplers in the walljump curriculum
vincentpierre Jun 29, 2020
a5f9edc
Changing the format of the curriculum file as per discussion
vincentpierre Jun 29, 2020
a6429c2
Addressing comments
vincentpierre Jun 30, 2020
cf76973
Update ml-agents/mlagents/trainers/settings.py
vincentpierre Jun 30, 2020
56256d2
Merging master
vincentpierre Jun 30, 2020
d89619b
Update docs/Migrating.md
vincentpierre Jul 7, 2020
5a61d30
addressing comments
vincentpierre Jul 7, 2020
3e7d61c
Merge branch 'master' into develop-env-param-refactor
vincentpierre Jul 7, 2020
020dbec
Merge branch 'master' into develop-env-param-refactor
vincentpierre Jul 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,7 @@ void ConfigureAgent(int config)
}
else
{
var min = m_ResetParams.GetWithDefault("big_wall_min_height", 8);
var max = m_ResetParams.GetWithDefault("big_wall_max_height", 8);
var height = min + Random.value * (max - min);
var height = m_ResetParams.GetWithDefault("big_wall_height", 8);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On WallJump, the sampling now happens using the sampler feature

localScale = new Vector3(
localScale.x,
height,
Expand Down
4 changes: 4 additions & 0 deletions com.unity.ml-agents/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to
#### ml-agents / ml-agents-envs / gym-unity (Python)
- The Parameter Randomization feature has been refactored to enable sampling of new parameters per episode to improve robustness. The
`resampling-interval` parameter has been removed and the config structure updated. More information [here](https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Training-ML-Agents.md). (#4065)
- The Parameter Randomization feature has been merged with the Curriculum feature. It is now possible to specify a sampler
in the lesson of a Curriculum. Curriculum has been refactored and is now specified at the level of the parameter, not the
behavior. More information
[here](https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Training-ML-Agents.md).(#4160)

### Minor Changes
#### com.unity.ml-agents (C#)
Expand Down
3 changes: 1 addition & 2 deletions config/ppo/3DBall_randomize.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ behaviors:
time_horizon: 1000
summary_freq: 12000
threaded: true

parameter_randomization:
environment_parameters:
mass:
sampler_type: uniform
sampler_parameters:
Expand Down
86 changes: 69 additions & 17 deletions config/ppo/WallJump_curriculum.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,72 @@ behaviors:
time_horizon: 128
summary_freq: 20000
threaded: true

curriculum:
BigWallJump:
measure: progress
thresholds: [0.1, 0.3, 0.5]
min_lesson_length: 100
signal_smoothing: true
parameters:
big_wall_min_height: [0.0, 4.0, 6.0, 8.0]
big_wall_max_height: [4.0, 7.0, 8.0, 8.0]
SmallWallJump:
measure: progress
thresholds: [0.1, 0.3, 0.5]
min_lesson_length: 100
signal_smoothing: true
parameters:
small_wall_height: [1.5, 2.0, 2.5, 4.0]
environment_parameters:
big_wall_height:
curriculum:
- name: Lesson0 # The '-' is important as this is a list
completion_criteria:
measure: progress
behavior: BigWallJump
signal_smoothing: true
min_lesson_length: 100
threshold: 0.1
value:
sampler_type: uniform
sampler_parameters:
min_value: 0.0
max_value: 4.0
- name: Lesson1 # This is the start of the second lesson
completion_criteria:
measure: progress
behavior: BigWallJump
signal_smoothing: true
min_lesson_length: 100
threshold: 0.3
value:
sampler_type: uniform
sampler_parameters:
min_value: 4.0
max_value: 7.0
- name: Lesson2
completion_criteria:
measure: progress
behavior: BigWallJump
signal_smoothing: true
min_lesson_length: 100
threshold: 0.5
value:
sampler_type: uniform
sampler_parameters:
min_value: 6.0
max_value: 8.0
- name: Lesson3
value: 8.0
small_wall_height:
curriculum:
- name: Lesson0
completion_criteria:
measure: progress
behavior: SmallWallJump
signal_smoothing: true
min_lesson_length: 100
threshold: 0.1
value: 1.5
- name: Lesson1
completion_criteria:
measure: progress
behavior: SmallWallJump
signal_smoothing: true
min_lesson_length: 100
threshold: 0.3
value: 2.0
- name: Lesson2
completion_criteria:
measure: progress
behavior: SmallWallJump
signal_smoothing: true
min_lesson_length: 100
threshold: 0.5
value: 2.5
- name: Lesson3
value: 4.0
16 changes: 15 additions & 1 deletion docs/Migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,21 @@ double-check that the versions are in the same. The versions can be found in

# Migrating

## Migrating from Release 1 to latest
## Migrating from Release 3 to latest

### Important changes
- The Parameter Randomization feature has been merged with the Curriculum feature. It is now possible to specify a sampler
in the lesson of a Curriculum. Curriculum has been refactored and is now specified at the level of the parameter, not the
behavior. More information
[here](https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Training-ML-Agents.md).(#4160)

### Steps to Migrate
- The configuration format for curriculum and parameter randomization has changed. To upgrade your configuration files,
an upgrade script has been provided. Run `python -m mlagents.trainers.upgrade_config -h` to see the script usage. Note that you will have had to upgrade to/install the current version of ML-Agents before running the script. To update manually:
- If your config file used a `parameter_randomization` section, rename that section to `environment_parameters`
- If your config file used a `curriculum` section, you will need to rewrite your curriculum with this [format](Training-ML-Agents.md#curriculum).

## Migrating from Release 1 to Release 3

### Important changes
- Training artifacts (trained models, summaries) are now found under `results/`
Expand Down
Loading