Skip to content

Commit a7c1fcc

Browse files
author
Ervin T
authored
Merge pull request #2648 from Unity-Technologies/release-0.10.0
Release 0.10.0
2 parents 493c75b + 600d94c commit a7c1fcc

File tree

781 files changed

+52633
-54253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

781 files changed

+52633
-54253
lines changed

.circleci/config.yml

Lines changed: 91 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,40 @@
1-
version: 2.0
2-
3-
jobs:
4-
build:
1+
version: 2.1
2+
executors:
3+
python361:
54
docker:
65
- image: circleci/python:3.6.1
6+
python373:
7+
docker:
8+
- image: circleci/python:3.7.3
9+
10+
jobs:
11+
build_python:
12+
parameters:
13+
executor:
14+
type: executor
15+
pyversion:
16+
type: string
17+
description: python version to being used (currently only affects caching).
18+
pip_constraints:
19+
type: string
20+
description: Constraints file that is passed to "pip install". We constraint older versions of libraries for older python runtime, in order to help ensure compatibility.
21+
executor: << parameters.executor >>
722
working_directory: ~/repo
823

924
steps:
1025
- checkout
1126

27+
- run:
28+
# Combine all the python dependencies into one file so that we can use that for the cache checksum
29+
name: Combine pip dependencies for caching
30+
command: cat ml-agents/setup.py ml-agents-envs/setup.py gym-unity/setup.py test_requirements.txt << parameters.pip_constraints >> > python_deps.txt
31+
1232
- restore_cache:
1333
keys:
14-
- v1-dependencies-{{ checksum "ml-agents/setup.py" }}
34+
# Parameterize the cache so that different python versions can get different versions of the packages
35+
- v1-dependencies-py<< parameters.pyversion >>-{{ checksum "python_deps.txt" }}
1536
# fallback to using the latest cache if no exact match is found
16-
- v1-dependencies-
37+
- v1-dependencies-py<< parameters.pyversion >>-
1738

1839
- run:
1940
name: Install Dependencies
@@ -22,22 +43,24 @@ jobs:
2243
. venv/bin/activate
2344
pip install --upgrade pip
2445
pip install --upgrade setuptools
25-
cd ml-agents-envs && pip install -e .
26-
cd ../ml-agents && pip install -e .
27-
pip install pre-commit pytest-cov==2.6.1
28-
cd ../gym-unity && pip install -e .
46+
pip install --progress-bar=off -e ./ml-agents-envs -c << parameters.pip_constraints >>
47+
pip install --progress-bar=off -e ./ml-agents -c << parameters.pip_constraints >>
48+
pip install --progress-bar=off -r test_requirements.txt -c << parameters.pip_constraints >>
49+
pip install --progress-bar=off -e ./gym-unity -c << parameters.pip_constraints >>
2950
3051
- save_cache:
3152
paths:
3253
- ./venv
33-
key: v1-dependencies-{{ checksum "ml-agents/setup.py" }}
54+
key: v1-dependencies-py<< parameters.pyversion >>-{{ checksum "python_deps.txt" }}
3455

3556
- run:
3657
name: Run Tests for ml-agents and gym_unity
58+
# This also dumps the installed pip packages to a file, so we can see what versions are actually being used.
3759
command: |
3860
. venv/bin/activate
3961
mkdir test-reports
40-
pytest --cov=mlagents --cov-report xml --junitxml=test-reports/junit.xml -p no:warnings
62+
pip freeze > test-reports/pip_versions.txt
63+
pytest --cov=ml-agents --cov=ml-agents-envs --cov=gym-unity --cov-report html --junitxml=test-reports/junit.xml -p no:warnings
4164
4265
- run:
4366
name: Check Code Style using pre-commit
@@ -58,3 +81,59 @@ jobs:
5881
- store_artifacts:
5982
path: test-reports
6083
destination: test-reports
84+
85+
- store_artifacts:
86+
path: htmlcov
87+
destination: htmlcov
88+
89+
90+
markdown_link_check:
91+
docker:
92+
- image: circleci/node:12.6.0
93+
working_directory: ~/repo
94+
95+
steps:
96+
- checkout
97+
98+
- restore_cache:
99+
keys:
100+
- v1-node-dependencies-{{ checksum ".pre-commit-config.yaml" }}
101+
# fallback to using the latest cache if no exact match is found
102+
- v1-node-dependencies-
103+
104+
- run:
105+
name: Install Dependencies
106+
command: |
107+
sudo apt-get install python3-venv
108+
python3 -m venv venv
109+
. venv/bin/activate
110+
pip install pre-commit
111+
- run: sudo npm install -g markdown-link-check
112+
113+
- save_cache:
114+
paths:
115+
- ./venv
116+
key: v1-node-dependencies-{{ checksum ".pre-commit-config.yaml" }}
117+
118+
- run:
119+
name: Run markdown-link-check via precommit
120+
command: |
121+
. venv/bin/activate
122+
pre-commit run --hook-stage manual markdown-link-check --all-files
123+
124+
workflows:
125+
workflow:
126+
jobs:
127+
- build_python:
128+
name: python_3.6.1
129+
executor: python361
130+
pyversion: 3.6.1
131+
# Test python 3.6 with the oldest supported versions
132+
pip_constraints: test_constraints_min_version.txt
133+
- build_python:
134+
name: python_3.7.3
135+
executor: python373
136+
pyversion: 3.7.3
137+
# Test python 3.7 with the newest supported versions
138+
pip_constraints: test_constraints_max_version.txt
139+
- markdown_link_check

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,5 @@ venv/
102102

103103
# Code coverage report
104104
.coverage
105+
coverage.xml
106+
/htmlcov/

.pre-commit-config.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ repos:
1515
files: "ml-agents-envs/.*"
1616
# Exclude protobuf files and don't follow them when imported
1717
exclude: ".*_pb2.py"
18-
# TODO get disallow-incomplete-defs working
19-
args: [--ignore-missing-imports, --follow-imports=silent]
18+
args: [--ignore-missing-imports, --disallow-incomplete-defs]
2019
- id: mypy
2120
name: mypy-gym-unity
2221
files: "gym-unity/.*"
@@ -37,3 +36,18 @@ repos:
3736
.*_pb2.py|
3837
.*_pb2_grpc.py
3938
)$
39+
# "Local" hooks, see https://pre-commit.com/#repository-local-hooks
40+
- repo: local
41+
hooks:
42+
- id: markdown-link-check
43+
name: markdown-link-check
44+
# markdown-link-check doesn't support multiple files on the commandline, so this hacks around that.
45+
# Note that you must install the package separately via npm. For example:
46+
# brew install npm; npm install -g markdown-link-check
47+
entry: bash -xc 'echo "$@" | xargs -n1 -t markdown-link-check -c markdown-link-check.config.json' --
48+
language: system
49+
types: [markdown]
50+
# Don't check localized files since their target might not be localized.
51+
exclude: ".*localized.*"
52+
# Only run manually, e.g. pre-commit run --hook-stage manual markdown-link-check
53+
stages: [manual]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ developer communities.
2525

2626
* Unity environment control from Python
2727
* 10+ sample Unity environments
28+
* Two deep reinforcement learning algorithms, [Proximal Policy Optimization](docs/Training-PPO.md) (PPO) and [Soft Actor-Critic](docs/Training-SAC.md) (SAC)
2829
* Support for multiple environment configurations and training scenarios
2930
* Train memory-enhanced agents using deep reinforcement learning
3031
* Easily definable Curriculum Learning and Generalization scenarios

UnitySDK/Assets/ML-Agents/Editor/AgentEditor.cs

100755100644
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using UnityEngine;
1+
using UnityEngine;
22
using UnityEditor;
33

44
namespace MLAgents
@@ -11,39 +11,38 @@ This code is meant to modify the behavior of the inspector on Brain Components.
1111
[CanEditMultipleObjects]
1212
public class AgentEditor : Editor
1313
{
14-
1514
public override void OnInspectorGUI()
1615
{
17-
SerializedObject serializedAgent = serializedObject;
16+
var serializedAgent = serializedObject;
1817
serializedAgent.Update();
1918

20-
SerializedProperty brain = serializedAgent.FindProperty("brain");
21-
SerializedProperty actionsPerDecision = serializedAgent.FindProperty(
19+
var brain = serializedAgent.FindProperty("brain");
20+
var actionsPerDecision = serializedAgent.FindProperty(
2221
"agentParameters.numberOfActionsBetweenDecisions");
23-
SerializedProperty maxSteps = serializedAgent.FindProperty(
22+
var maxSteps = serializedAgent.FindProperty(
2423
"agentParameters.maxStep");
25-
SerializedProperty isResetOnDone = serializedAgent.FindProperty(
24+
var isResetOnDone = serializedAgent.FindProperty(
2625
"agentParameters.resetOnDone");
27-
SerializedProperty isODD = serializedAgent.FindProperty(
26+
var isOdd = serializedAgent.FindProperty(
2827
"agentParameters.onDemandDecision");
29-
SerializedProperty cameras = serializedAgent.FindProperty(
28+
var cameras = serializedAgent.FindProperty(
3029
"agentParameters.agentCameras");
31-
SerializedProperty renderTextures = serializedAgent.FindProperty(
30+
var renderTextures = serializedAgent.FindProperty(
3231
"agentParameters.agentRenderTextures");
3332

3433
EditorGUILayout.PropertyField(brain);
3534

3635
if (cameras.arraySize > 0 && renderTextures.arraySize > 0)
3736
{
38-
EditorGUILayout.HelpBox("Brain visual observations created by first getting all cameras then all render textures.", MessageType.Info);
37+
EditorGUILayout.HelpBox("Brain visual observations created by first getting all cameras then all render textures.", MessageType.Info);
3938
}
40-
39+
4140
EditorGUILayout.LabelField("Agent Cameras");
42-
for (int i = 0; i < cameras.arraySize; i++)
41+
for (var i = 0; i < cameras.arraySize; i++)
4342
{
4443
EditorGUILayout.PropertyField(
4544
cameras.GetArrayElementAtIndex(i),
46-
new GUIContent("Camera " + (i + 1).ToString() + ": "));
45+
new GUIContent("Camera " + (i + 1) + ": "));
4746
}
4847

4948
EditorGUILayout.BeginHorizontal();
@@ -58,13 +57,13 @@ public override void OnInspectorGUI()
5857
}
5958

6059
EditorGUILayout.EndHorizontal();
61-
60+
6261
EditorGUILayout.LabelField("Agent RenderTextures");
63-
for (int i = 0; i < renderTextures.arraySize; i++)
62+
for (var i = 0; i < renderTextures.arraySize; i++)
6463
{
6564
EditorGUILayout.PropertyField(
6665
renderTextures.GetArrayElementAtIndex(i),
67-
new GUIContent("RenderTexture " + (i + 1).ToString() + ": "));
66+
new GUIContent("RenderTexture " + (i + 1) + ": "));
6867
}
6968

7069
EditorGUILayout.BeginHorizontal();
@@ -91,11 +90,11 @@ public override void OnInspectorGUI()
9190
"Reset On Done",
9291
"If checked, the agent will reset on done. Else, AgentOnDone() will be called."));
9392
EditorGUILayout.PropertyField(
94-
isODD,
93+
isOdd,
9594
new GUIContent(
9695
"On Demand Decisions",
9796
"If checked, you must manually request decisions."));
98-
if (!isODD.boolValue)
97+
if (!isOdd.boolValue)
9998
{
10099
EditorGUILayout.PropertyField(
101100
actionsPerDecision,

UnitySDK/Assets/ML-Agents/Editor/BrainEditor.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using UnityEngine;
1+
using UnityEngine;
22
using UnityEditor;
33

44

@@ -11,10 +11,10 @@ namespace MLAgents
1111
/// </summary>
1212
[CustomEditor(typeof(Brain))]
1313
public class BrainEditor : Editor
14-
{
14+
{
1515
public override void OnInspectorGUI()
1616
{
17-
var brain = (Brain) target;
17+
var brain = (Brain)target;
1818
var brainToCopy = EditorGUILayout.ObjectField(
1919
"Copy Brain Parameters from : ", null, typeof(Brain), false) as Brain;
2020
if (brainToCopy != null)
@@ -25,10 +25,10 @@ public override void OnInspectorGUI()
2525
return;
2626
}
2727
var serializedBrain = serializedObject;
28-
serializedBrain.Update();
28+
serializedBrain.Update();
2929
EditorGUILayout.PropertyField(serializedBrain.FindProperty("brainParameters"), true);
3030
serializedBrain.ApplyModifiedProperties();
31-
31+
3232
// Draws a horizontal thick line
3333
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
3434
}

0 commit comments

Comments
 (0)