AnnaMats commited on
Commit
05c9ac2
·
1 Parent(s): df142c3

Second Push

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .editorconfig +74 -0
  2. .gitattributes +88 -35
  3. .github/ISSUE_TEMPLATE/bug_report.md +33 -0
  4. .github/ISSUE_TEMPLATE/config.yml +11 -0
  5. .github/ISSUE_TEMPLATE/feature_request.md +20 -0
  6. .github/PULL_REQUEST_TEMPLATE.md +24 -0
  7. .github/stale.yml +26 -0
  8. .github/workflows/colab.yml +65 -0
  9. .github/workflows/lock.yml +23 -0
  10. .github/workflows/nightly.yml +92 -0
  11. .github/workflows/pre-commit.yml +57 -0
  12. .github/workflows/publish_docs.yaml +24 -0
  13. .github/workflows/publish_pypi.yaml +48 -0
  14. .github/workflows/publish_pypi_python_api.yaml +50 -0
  15. .github/workflows/pytest.yml +100 -0
  16. .github/workflows/validate_catalog.yaml +21 -0
  17. .gitignore +97 -0
  18. .gitmodules +0 -0
  19. .pre-commit-config.yaml +138 -0
  20. .pre-commit-search-and-replace.yaml +8 -0
  21. .yamato/com.unity.ml-agents-coverage.yml +43 -0
  22. .yamato/com.unity.ml-agents-pack.yml +21 -0
  23. .yamato/com.unity.ml-agents-performance.yml +30 -0
  24. .yamato/com.unity.ml-agents-promotion.yml +67 -0
  25. .yamato/com.unity.ml-agents-publish.yml +23 -0
  26. .yamato/com.unity.ml-agents-test.yml +152 -0
  27. .yamato/compressed-sensor-test.yml +38 -0
  28. .yamato/coverage_tests.metafile +17 -0
  29. .yamato/gym-interface-test.yml +37 -0
  30. .yamato/protobuf-generation-test.yml +44 -0
  31. .yamato/pytest-gpu.yml +32 -0
  32. .yamato/python-ll-api-test.yml +39 -0
  33. .yamato/sonar-python-package.yml +21 -0
  34. .yamato/standalone-build-test.yml +44 -0
  35. .yamato/standalone-build-webgl-test.yml +30 -0
  36. .yamato/test_versions.metafile +11 -0
  37. .yamato/training-int-tests.yml +44 -0
  38. CODE_OF_CONDUCT.md +74 -0
  39. DevProject/.gitignore +71 -0
  40. DevProject/Assets/ML-Agents.meta +8 -0
  41. DevProject/Assets/ML-Agents/Scripts.meta +8 -0
  42. DevProject/Assets/ML-Agents/Scripts/Tests.meta +8 -0
  43. DevProject/Assets/ML-Agents/Scripts/Tests/Editor.meta +8 -0
  44. DevProject/Assets/ML-Agents/Scripts/Tests/Editor/Editor.asmdef +28 -0
  45. DevProject/Assets/ML-Agents/Scripts/Tests/Editor/Editor.asmdef.meta +7 -0
  46. DevProject/Assets/ML-Agents/Scripts/Tests/Editor/MLAgentsSettings.meta +8 -0
  47. DevProject/Assets/ML-Agents/Scripts/Tests/Editor/MLAgentsSettings/MLAgentsSettingsTests.cs +171 -0
  48. DevProject/Assets/ML-Agents/Scripts/Tests/Editor/MLAgentsSettings/MLAgentsSettingsTests.cs.meta +11 -0
  49. DevProject/Assets/ML-Agents/Scripts/Tests/Editor/Performance.meta +8 -0
  50. DevProject/Assets/ML-Agents/Scripts/Tests/Editor/Performance/SensorPerformanceTests.cs +195 -0
.editorconfig ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ; see http://editorconfig.org/ for docs on this file
2
+
3
+ root = true
4
+
5
+ [*]
6
+ ignore_if_in_header = This code was generated by a tool|<auto-generated>
7
+ indent_style = space
8
+ indent_size = 4
9
+ ; uncomment to help with sharing files across os's (i.e. network share or through local vm)
10
+ #end_of_line = lf
11
+ ; avoid a bom, which causes endless problems with naive text tooling
12
+ charset = utf-8
13
+ trim_trailing_whitespace = true
14
+ insert_final_newline = true
15
+ ; keeping auto-format enabled helps avoid merge hell for projects without CI-based format validation
16
+ #disable_auto_format = true
17
+
18
+ [*.cs]
19
+ ; uncomment to enable full formatting of c# files
20
+ formatters = generic, uncrustify
21
+
22
+ [*.asmdef]
23
+ scrape_api = true
24
+
25
+ [**/Tests/**.asmdef]
26
+ scrape_api = false
27
+
28
+ [*.Tests.asmdef]
29
+ scrape_api = false
30
+
31
+ [*.md]
32
+ indent_size = 2
33
+ ; trailing whitespace is unfortunately significant in markdown
34
+ trim_trailing_whitespace = false
35
+ ; uncomment to enable basic formatting of markdown files
36
+ #formatters = generic
37
+
38
+ [{Makefile,makefile}]
39
+ ; tab characters are part of the Makefile format
40
+ indent_style = tab
41
+
42
+ [*.asmdef]
43
+ indent_size = 4
44
+
45
+ [*.json]
46
+ indent_size = 2
47
+
48
+ [*.{vcproj,bat,cmd,xaml,tt,t4,ttinclude}]
49
+ end_of_line = crlf
50
+
51
+ ; this VS-specific stuff is based on experiments to see how VS will modify a file after it has been manually edited.
52
+ ; the settings are meant to closely match what VS does to minimize unnecessary diffs.
53
+ [*.{vcxproj,vcxproj.filters}]
54
+ indent_style = space
55
+ indent_size = 2
56
+ end_of_line = crlf
57
+ charset = utf-8-bom
58
+ trim_trailing_whitespace = true
59
+ insert_final_newline = false
60
+ ; must be broken out because of 51-char bug (https://github.com/editorconfig/editorconfig-visualstudio/issues/21)
61
+ [*.{csproj,pyproj,props,targets}]
62
+ indent_style = space
63
+ indent_size = 2
64
+ end_of_line = crlf
65
+ charset = utf-8-bom
66
+ trim_trailing_whitespace = true
67
+ insert_final_newline = false
68
+ [*.{sln,sln.template}]
69
+ indent_style = tab
70
+ indent_size = 4
71
+ end_of_line = crlf
72
+ charset = utf-8
73
+ trim_trailing_whitespace = true
74
+ insert_final_newline = false
.gitattributes CHANGED
@@ -1,35 +1,88 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.asset binary
2
+ *.unity binary
3
+ *.prefab binary
4
+ *.meta binary
5
+ */CommunicatorObjects/* binary
6
+ */communicator_objects/* binary
7
+ *.md text
8
+ Project/Assets/ML-Agents/Examples/3DBall/TFModels/3DBallHard.onnx filter=lfs diff=lfs merge=lfs -text
9
+ Project/Assets/ML-Agents/Examples/3DBall/TFModels/Visual3DBall.nn filter=lfs diff=lfs merge=lfs -text
10
+ Project/Assets/ML-Agents/Examples/Crawler/Demos/ExpertCrawler.demo filter=lfs diff=lfs merge=lfs -text
11
+ Project/Assets/ML-Agents/Examples/Crawler/TFModels/Crawler.onnx filter=lfs diff=lfs merge=lfs -text
12
+ Project/Assets/ML-Agents/Examples/DungeonEscape/TFModels/DungeonEscape.onnx filter=lfs diff=lfs merge=lfs -text
13
+ Project/Assets/ML-Agents/Examples/FoodCollector/TFModels/GridFoodCollector.onnx filter=lfs diff=lfs merge=lfs -text
14
+ Project/Assets/ML-Agents/Examples/FoodCollector/TFModels/VisualFoodCollector.onnx filter=lfs diff=lfs merge=lfs -text
15
+ Project/Assets/ML-Agents/Examples/GridFoodCollector.onnx filter=lfs diff=lfs merge=lfs -text
16
+ Project/Assets/ML-Agents/Examples/GridWorld/Demos/ExpertGridWorld.demo filter=lfs diff=lfs merge=lfs -text
17
+ Project/Assets/ML-Agents/Examples/GridWorld/TFModels/GridWorld.onnx filter=lfs diff=lfs merge=lfs -text
18
+ Project/Assets/ML-Agents/Examples/GridWorld/TFModels/GridWorldColab.onnx filter=lfs diff=lfs merge=lfs -text
19
+ Project/Assets/ML-Agents/Examples/Hallway/Demos/ExpertHallway.demo filter=lfs diff=lfs merge=lfs -text
20
+ Project/Assets/ML-Agents/Examples/Hallway/TFModels/Hallway.onnx filter=lfs diff=lfs merge=lfs -text
21
+ Project/Assets/ML-Agents/Examples/Match3/TFModels/Match3VectorObs.onnx filter=lfs diff=lfs merge=lfs -text
22
+ Project/Assets/ML-Agents/Examples/Match3/TFModels/Match3VisualObs.onnx filter=lfs diff=lfs merge=lfs -text
23
+ Project/Assets/ML-Agents/Examples/PushBlock/Demos/ExpertPushBlock.demo filter=lfs diff=lfs merge=lfs -text
24
+ Project/Assets/ML-Agents/Examples/PushBlock/TFModels/PushBlockCollab.onnx filter=lfs diff=lfs merge=lfs -text
25
+ Project/Assets/ML-Agents/Examples/PushBlockWithInput/TFModels/PushBlock.onnx filter=lfs diff=lfs merge=lfs -text
26
+ Project/Assets/ML-Agents/Examples/Pyramids/Demos/ExpertPyramid.demo filter=lfs diff=lfs merge=lfs -text
27
+ Project/Assets/ML-Agents/Examples/Pyramids/TFModels/Pyramids.nn filter=lfs diff=lfs merge=lfs -text
28
+ Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_CO.tif filter=lfs diff=lfs merge=lfs -text
29
+ Project/Assets/ML-Agents/Examples/Soccer/TFModels/Goalie.nn filter=lfs diff=lfs merge=lfs -text
30
+ Project/Assets/ML-Agents/Examples/Soccer/TFModels/SoccerTwos.onnx filter=lfs diff=lfs merge=lfs -text
31
+ Project/Assets/ML-Agents/Examples/Soccer/TFModels/Striker.nn filter=lfs diff=lfs merge=lfs -text
32
+ Project/Assets/ML-Agents/Examples/Sorter/TFModels/Sorter.onnx filter=lfs diff=lfs merge=lfs -text
33
+ Project/Assets/ML-Agents/Examples/Walker/Demos/ExpertWalker.demo filter=lfs diff=lfs merge=lfs -text
34
+ Project/Assets/ML-Agents/Examples/Walker/TFModels/Walker.onnx filter=lfs diff=lfs merge=lfs -text
35
+ Project/Assets/ML-Agents/Examples/Worm/TFModels/Worm.nn filter=lfs diff=lfs merge=lfs -text
36
+ Project/Recordings/movie.mp4 filter=lfs diff=lfs merge=lfs -text
37
+ com.unity.ml-agents/Plugins/ProtoBuffer/runtimes/linux/native/libgrpc_csharp_ext.x64.so filter=lfs diff=lfs merge=lfs -text
38
+ com.unity.ml-agents/Plugins/ProtoBuffer/runtimes/linux/native/libgrpc_csharp_ext.x86.so filter=lfs diff=lfs merge=lfs -text
39
+ com.unity.ml-agents/Plugins/ProtoBuffer/runtimes/osx/native/libgrpc_csharp_ext.x64.bundle filter=lfs diff=lfs merge=lfs -text
40
+ com.unity.ml-agents/Plugins/ProtoBuffer/runtimes/win/native/grpc_csharp_ext.x64.dll filter=lfs diff=lfs merge=lfs -text
41
+ com.unity.ml-agents/Plugins/ProtoBuffer/runtimes/win/native/grpc_csharp_ext.x86.dll filter=lfs diff=lfs merge=lfs -text
42
+ com.unity.ml-agents/Tests/Editor/TestModels/continuous2vis8vec2action_v1_0.onnx filter=lfs diff=lfs merge=lfs -text
43
+ com.unity.ml-agents/Tests/Editor/TestModels/deterContinuous2vis8vec2action_v2_0.onnx filter=lfs diff=lfs merge=lfs -text
44
+ com.unity.ml-agents/Tests/Editor/TestModels/deterDiscrete1obs3action_v2_0.onnx filter=lfs diff=lfs merge=lfs -text
45
+ com.unity.ml-agents/Tests/Editor/TestModels/discrete1vis0vec_2_3action_obsolete_recurr_v1_0.onnx filter=lfs diff=lfs merge=lfs -text
46
+ com.unity.ml-agents/Tests/Editor/TestModels/discrete1vis0vec_2_3action_v1_0.onnx filter=lfs diff=lfs merge=lfs -text
47
+ com.unity.ml-agents/Tests/Editor/TestModels/discrete_rank2_vector_v2_0.onnx filter=lfs diff=lfs merge=lfs -text
48
+ com.unity.ml-agents/Tests/Editor/TestModels/hybrid0vis53vec_3c_2daction_v1_0.onnx filter=lfs diff=lfs merge=lfs -text
49
+ com.unity.ml-agents/Tests/Editor/TestModels/hybrid0vis8vec_2c_2_3d_v2_0.onnx filter=lfs diff=lfs merge=lfs -text
50
+ docs/images/image-banner.png filter=lfs diff=lfs merge=lfs -text
51
+ localized_docs/KR/docs/images/image-banner.png filter=lfs diff=lfs merge=lfs -text
52
+ results/Pyramids[[:space:]]Training/Pyramids/Pyramids-100064.onnx filter=lfs diff=lfs merge=lfs -text
53
+ results/Pyramids[[:space:]]Training/Pyramids/Pyramids-100064.pt filter=lfs diff=lfs merge=lfs -text
54
+ results/Pyramids[[:space:]]Training/Pyramids/checkpoint.pt filter=lfs diff=lfs merge=lfs -text
55
+ results/Pyramids[[:space:]]Training/Pyramids/events.out.tfevents.1692804545.f1fcbdb9d0a8.1697.0 filter=lfs diff=lfs merge=lfs -text
56
+ results/Pyramids[[:space:]]Training/Pyramids.onnx filter=lfs diff=lfs merge=lfs -text
57
+ training-envs-executables/linux/Pyramids/Pyramids_Data/Managed/System.Core.dll filter=lfs diff=lfs merge=lfs -text
58
+ training-envs-executables/linux/Pyramids/Pyramids_Data/Managed/System.Data.dll filter=lfs diff=lfs merge=lfs -text
59
+ training-envs-executables/linux/Pyramids/Pyramids_Data/Managed/System.Xml.dll filter=lfs diff=lfs merge=lfs -text
60
+ training-envs-executables/linux/Pyramids/Pyramids_Data/Managed/System.dll filter=lfs diff=lfs merge=lfs -text
61
+ training-envs-executables/linux/Pyramids/Pyramids_Data/Managed/Unity.InputSystem.dll filter=lfs diff=lfs merge=lfs -text
62
+ training-envs-executables/linux/Pyramids/Pyramids_Data/Managed/UnityEngine.CoreModule.dll filter=lfs diff=lfs merge=lfs -text
63
+ training-envs-executables/linux/Pyramids/Pyramids_Data/Managed/UnityEngine.UIElementsModule.dll filter=lfs diff=lfs merge=lfs -text
64
+ training-envs-executables/linux/Pyramids/Pyramids_Data/Managed/mscorlib.dll filter=lfs diff=lfs merge=lfs -text
65
+ training-envs-executables/linux/Pyramids/Pyramids_Data/MonoBleedingEdge/x86_64/libmono-native.so filter=lfs diff=lfs merge=lfs -text
66
+ training-envs-executables/linux/Pyramids/Pyramids_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so filter=lfs diff=lfs merge=lfs -text
67
+ training-envs-executables/linux/Pyramids/Pyramids_Data/Plugins/lib_burst_generated.so filter=lfs diff=lfs merge=lfs -text
68
+ training-envs-executables/linux/Pyramids/Pyramids_Data/Plugins/libgrpc_csharp_ext.x64.so filter=lfs diff=lfs merge=lfs -text
69
+ training-envs-executables/linux/Pyramids/Pyramids_Data/Resources/unity[[:space:]]default[[:space:]]resources filter=lfs diff=lfs merge=lfs -text
70
+ training-envs-executables/linux/Pyramids/Pyramids_Data/resources.assets filter=lfs diff=lfs merge=lfs -text
71
+ training-envs-executables/linux/Pyramids/Pyramids_Data/sharedassets0.assets.resS filter=lfs diff=lfs merge=lfs -text
72
+ training-envs-executables/linux/Pyramids/UnityPlayer.so filter=lfs diff=lfs merge=lfs -text
73
+ training-envs-executables/linux/Pyramids.zip filter=lfs diff=lfs merge=lfs -text
74
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/Managed/System.Core.dll filter=lfs diff=lfs merge=lfs -text
75
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/Managed/System.Data.dll filter=lfs diff=lfs merge=lfs -text
76
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/Managed/System.Xml.dll filter=lfs diff=lfs merge=lfs -text
77
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/Managed/System.dll filter=lfs diff=lfs merge=lfs -text
78
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/Managed/UnityEngine.CoreModule.dll filter=lfs diff=lfs merge=lfs -text
79
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/Managed/UnityEngine.UIElementsModule.dll filter=lfs diff=lfs merge=lfs -text
80
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/Managed/mscorlib.dll filter=lfs diff=lfs merge=lfs -text
81
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/MonoBleedingEdge/x86_64/libmono-native.so filter=lfs diff=lfs merge=lfs -text
82
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so filter=lfs diff=lfs merge=lfs -text
83
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/Plugins/libgrpc_csharp_ext.x64.so filter=lfs diff=lfs merge=lfs -text
84
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/Resources/unity[[:space:]]default[[:space:]]resources filter=lfs diff=lfs merge=lfs -text
85
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/resources.assets filter=lfs diff=lfs merge=lfs -text
86
+ training-envs-executables/linux/SnowballTarget/SnowballTarget_Data/resources.assets.resS filter=lfs diff=lfs merge=lfs -text
87
+ training-envs-executables/linux/SnowballTarget/UnityPlayer.so filter=lfs diff=lfs merge=lfs -text
88
+ training-envs-executables/linux/SnowballTarget.zip filter=lfs diff=lfs merge=lfs -text
.github/ISSUE_TEMPLATE/bug_report.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Bug report
3
+ about: Report a bug with ML-Agents
4
+ title: ''
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Console logs / stack traces**
21
+ Please wrap in triple backticks (```) to make it easier to read.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Environment (please complete the following information):**
27
+ - Unity Version: [e.g. Unity 2022.3f1]
28
+ - OS + version: [e.g. Windows 10]
29
+ - _ML-Agents version_: (e.g. ML-Agents v0.8, or latest `develop` branch from source)
30
+ - _Torch version_: (you can run `pip3 show torch` to get this)
31
+ - _Environment_: (which example environment you used to reproduce the error)
32
+
33
+ **NOTE:** We are unable to help reproduce bugs with custom environments. Please attempt to reproduce your issue with one of the example environments, or provide a minimal patch to one of the environments needed to reproduce the issue.
.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Discussion / General Questions
4
+ url: https://forum.unity.com/forums/ml-agents.453/
5
+ about: Discussion about ML-Agents, RL algorithms, or game integrations.
6
+ - name: Installation / Setup
7
+ url: https://forum.unity.com/forums/ml-agents.453/
8
+ about: Questions about python installation, initial connection between Unity and training, etc.
9
+ - name: ML-Agents Unity Forum
10
+ url: https://forum.unity.com/forums/ml-agents.453/
11
+ about: Please ask other questions in the ML-Agents Unity Forum.
.github/ISSUE_TEMPLATE/feature_request.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: request
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
.github/PULL_REQUEST_TEMPLATE.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Proposed change(s)
2
+
3
+ Describe the changes made in this PR.
4
+
5
+ ### Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)
6
+
7
+
8
+
9
+ ### Types of change(s)
10
+
11
+ - [ ] Bug fix
12
+ - [ ] New feature
13
+ - [ ] Code refactor
14
+ - [ ] Breaking change
15
+ - [ ] Documentation update
16
+ - [ ] Other (please describe)
17
+
18
+ ### Checklist
19
+ - [ ] Added tests that prove my fix is effective or that my feature works
20
+ - [ ] Updated the changelog (if applicable)
21
+ - [ ] Updated the documentation (if applicable)
22
+ - [ ] Updated the migration guide (if applicable)
23
+
24
+ ### Other comments
.github/stale.yml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Configuration for probot-stale - https://github.com/probot/stale
2
+
3
+ # General configuration
4
+ # Label to use when marking as stale
5
+ staleLabel: stale
6
+
7
+ # Only run on issues
8
+ only: issues
9
+
10
+ # Issue specific configuration
11
+ issues:
12
+ limitPerRun: 5
13
+ daysUntilStale: 90
14
+ daysUntilClose: 30
15
+ markComment: >
16
+ This issue has been automatically marked as stale because it has not had activity in the
17
+ last 90 days. It will be closed in the next 30 days if no further activity occurs.
18
+ Thank you for your contributions.
19
+ closeComment: >
20
+ This issue has been automatically closed because it has not had activity in the
21
+ last 120 days. If this issue is still valid, please ping a maintainer.
22
+ Thank you for your contributions.
23
+ exemptLabels:
24
+ - request
25
+ - help-wanted
26
+ - announcement
.github/workflows/colab.yml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: colab
2
+
3
+ on:
4
+ pull_request:
5
+ paths: # This action will only run if the PR modifies a file in one of these directories
6
+ - 'ml-agents-envs/**'
7
+ - 'gym-unity/**'
8
+ - 'colab/**'
9
+ - '.github/workflows/colab.yml'
10
+ push:
11
+ branches:
12
+ - main
13
+ - develop
14
+ - 'release/**'
15
+ workflow_dispatch:
16
+
17
+ jobs:
18
+ colab:
19
+ runs-on: ubuntu-latest
20
+ env:
21
+ COLAB_ALWAYS_INSTALL_XVFB: 1
22
+ QLEARNING_NUM_TRAINING_STEPS: 5
23
+ QLEARNING_NUM_NEW_EXP: 64
24
+ QLEARNING_BUFFER_SIZE: 64
25
+ strategy:
26
+ fail-fast: false
27
+ matrix:
28
+ notebook_path: [Colab_UnityEnvironment_1_Run.ipynb, Colab_UnityEnvironment_2_Train.ipynb, Colab_UnityEnvironment_3_SideChannel.ipynb]
29
+ steps:
30
+ - uses: actions/checkout@v2
31
+ - name: Set up Python
32
+ uses: actions/setup-python@v2
33
+ with:
34
+ python-version: 3.9.x
35
+ - uses: actions/setup-dotnet@v1
36
+ with:
37
+ dotnet-version: '6.0.x'
38
+ - name: Cache pip
39
+ uses: actions/cache@v2
40
+ with:
41
+ # This path is specific to Ubuntu
42
+ path: ~/.cache/pip
43
+ # Look to see if there is a cache hit for the corresponding requirements file
44
+ key: ${{ runner.os }}-pip-${{ hashFiles('ml-agents/setup.py', 'ml-agents-envs/setup.py', 'gym-unity/setup.py', 'colab_requirements.txt') }}
45
+ restore-keys: |
46
+ ${{ runner.os }}-pip-
47
+ ${{ runner.os }}-
48
+ - name: Install dependencies
49
+ run: |
50
+ python -m pip install --upgrade pip
51
+ python -m pip install --upgrade setuptools
52
+ # Install the local checkouts of ml-agents. This will prevent the colab notebooks from installing a released version.
53
+ python -m pip install --progress-bar=off -e ./ml-agents-envs
54
+ python -m pip install --progress-bar=off -e ./ml-agents
55
+ python -m pip install --progress-bar=off -r colab_requirements.txt
56
+ - name: Execute notebook
57
+ run: jupyter nbconvert --to notebook --execute --log-level=DEBUG --ExecutePreprocessor.kernel_name=python3 --output output-${{ matrix.notebook_path }} colab/${{ matrix.notebook_path }}
58
+ - name: Upload colab results
59
+ uses: actions/upload-artifact@v2
60
+ with:
61
+ name: artifacts
62
+ path: |
63
+ colab/output-${{ matrix.notebook_path }}
64
+ # Use always() to always run this step to publish execution results when there are failures
65
+ if: ${{ always() }}
.github/workflows/lock.yml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: 'Lock Threads'
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 0/4 * * *'
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ lock:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: dessant/lock-threads@v2
13
+ with:
14
+ github-token: ${{ github.token }}
15
+ issue-lock-inactive-days: '30'
16
+ issue-exclude-created-before: ''
17
+ issue-exclude-labels: ''
18
+ issue-lock-labels: ''
19
+ issue-lock-comment: >
20
+ This thread has been automatically locked since there has not been
21
+ any recent activity after it was closed. Please open a new issue for
22
+ related bugs.
23
+ issue-lock-reason: 'resolved'
.github/workflows/nightly.yml ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: nightly
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 7 * * *' # run at 7 AM UTC == midnight PST
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ markdown-link-check-full:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - uses: actions/setup-python@v2
14
+ - uses: actions/setup-node@v2
15
+ with:
16
+ node-version: '12'
17
+ - name: Install manual dependencies
18
+ run: |
19
+ sudo npm install -g markdown-link-check@3.8.7
20
+ python -m pip install pre-commit
21
+ pre-commit install
22
+ - name: Run markdown checker
23
+ run: |
24
+ pre-commit run --hook-stage manual markdown-link-check-full --all-files
25
+ full-pytest:
26
+ runs-on: ubuntu-latest
27
+ # TODO: Re-use pytest workflow once https://github.com/github/roadmap/issues/257 is done.
28
+ # steps:
29
+ # - uses: actions/checkout@v2
30
+ # - uses: ./.github/workflows/pytest.yml
31
+ # with:
32
+ # # Run all tests.
33
+ # pytest_markers: "not slow or slow"
34
+ env:
35
+ TEST_ENFORCE_BUFFER_KEY_TYPES: 1
36
+ strategy:
37
+ # If one test in the matrix fails we still want to run the others.
38
+ fail-fast: false
39
+ matrix:
40
+ python-version: [3.8.x, 3.9.x, 3.10.x]
41
+ include:
42
+ - python-version: 3.8.x
43
+ pip_constraints: test_constraints_min_version.txt
44
+ - python-version: 3.9.x
45
+ pip_constraints: test_constraints_mid_version.txt
46
+ - python-version: 3.10.x
47
+ pip_constraints: test_constraints_max_version.txt
48
+ steps:
49
+ - uses: actions/checkout@v2
50
+ - name: Set up Python
51
+ uses: actions/setup-python@v2
52
+ with:
53
+ python-version: ${{ matrix.python-version }}
54
+ - name: Cache pip
55
+ uses: actions/cache@v2
56
+ with:
57
+ # This path is specific to Ubuntu
58
+ path: ~/.cache/pip
59
+ # Look to see if there is a cache hit for the corresponding requirements file
60
+ key: ${{ runner.os }}-pip-${{ hashFiles('ml-agents/setup.py', 'ml-agents-envs/setup.py', 'test_requirements.txt', matrix.pip_constraints) }}
61
+ restore-keys: |
62
+ ${{ runner.os }}-pip-
63
+ ${{ runner.os }}-
64
+ - name: Display Python version
65
+ run: python -c "import sys; print(sys.version)"
66
+ - name: Install dependencies
67
+ run: |
68
+ python -m pip install --upgrade pip
69
+ python -m pip install --upgrade setuptools
70
+ python -m pip install --progress-bar=off -e ./ml-agents-envs -c ${{ matrix.pip_constraints }}
71
+ python -m pip install --progress-bar=off -e ./ml-agents -c ${{ matrix.pip_constraints }}
72
+ python -m pip install --progress-bar=off -r test_requirements.txt -c ${{ matrix.pip_constraints }}
73
+ python -m pip install --progress-bar=off -e ./ml-agents-plugin-examples -c ${{ matrix.pip_constraints }}
74
+ - name: Save python dependencies
75
+ run: |
76
+ pip freeze > pip_versions-${{ matrix.python-version }}.txt
77
+ cat pip_versions-${{ matrix.python-version }}.txt
78
+ - name: Run pytest
79
+ run: |
80
+ pytest --cov=ml-agents --cov=ml-agents-envs \
81
+ --cov-report=html --junitxml=junit/test-results-${{ matrix.python-version }}.xml \
82
+ -p no:warnings -v -n 8
83
+ - name: Upload pytest test results
84
+ uses: actions/upload-artifact@v2
85
+ with:
86
+ name: artifacts-${{ matrix.python-version }}
87
+ path: |
88
+ htmlcov
89
+ pip_versions-${{ matrix.python-version }}.txt
90
+ junit/test-results-${{ matrix.python-version }}.xml
91
+ # Use always() to always run this step to publish test results when there are test failures
92
+ if: ${{ always() }}
.github/workflows/pre-commit.yml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: pre-commit
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+ - develop
9
+ - 'release/**'
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ pre-commit:
14
+ runs-on: ubuntu-20.04
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: actions/setup-python@v2
18
+ with:
19
+ python-version: 3.8.x
20
+ - uses: actions/setup-ruby@v1
21
+ env:
22
+ ImageOS: ubuntu20
23
+ with:
24
+ ruby-version: '2.6'
25
+ - uses: actions/setup-dotnet@v3
26
+ with:
27
+ dotnet-version: '7.0.100'
28
+ - name: Install manual dependencies
29
+ run: |
30
+ python -m pip install pre-commit
31
+ pre-commit install
32
+ - name: Run pre-commit
33
+ run: |
34
+ pre-commit run --all-files
35
+ markdown-link-check:
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: actions/checkout@v2
39
+ - uses: actions/setup-python@v2
40
+ - uses: actions/setup-node@v2
41
+ with:
42
+ node-version: '12'
43
+ - name: Install manual dependencies
44
+ # pin markdown-link-check version to support multi-level reference link
45
+ run: |
46
+ sudo npm install -g markdown-link-check@3.8.7
47
+ python -m pip install pre-commit
48
+ pre-commit install
49
+ - name: Run markdown checker
50
+ run: |
51
+ pre-commit run --hook-stage manual markdown-link-check --all-files
52
+ validate-meta-files:
53
+ runs-on: ubuntu-latest
54
+ steps:
55
+ - uses: actions/checkout@v2
56
+ - uses: actions/setup-python@v2
57
+ - run: python utils/validate_meta_files.py
.github/workflows/publish_docs.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Publish HTML Docs
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ publish:
8
+ name: Publish Docs to GH Pages
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout
12
+ uses: actions/checkout@v2
13
+ with:
14
+ token: ${{ secrets.PUBLIC_GH_TOKEN }}
15
+ - name: Setup Python 3.8
16
+ uses: actions/setup-python@v2
17
+ with:
18
+ python-version: 3.8
19
+ - name: Publish docs
20
+ run: |
21
+ pip install mkdocs
22
+ git remote add public git@github.com:Unity-Technologies/ml-agents.git
23
+ mkdocs gh-deploy --clean -r public
24
+
.github/workflows/publish_pypi.yaml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Adapted from https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
2
+ name: Publish to PyPI (or TestPyPI)
3
+
4
+ on:
5
+ push:
6
+ tags:
7
+ - "release_[0-9]+_test[0-9]+"
8
+ - "release_[0-9]+"
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ build-and-publish:
13
+ name: publish to PyPI (or TestPyPI)
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ package-path: [ml-agents, ml-agents-envs]
18
+
19
+ steps:
20
+ - uses: actions/checkout@main
21
+ - name: Set up Python 3.8
22
+ uses: actions/setup-python@v2
23
+ with:
24
+ python-version: 3.8
25
+ - name: Install dependencies
26
+ run: pip install setuptools wheel twine --user
27
+ - name: verify git tag vs. version
28
+ run: |
29
+ cd ${{ matrix.package-path }}
30
+ python setup.py verify
31
+ - name: Build package
32
+ run: |
33
+ cd ${{ matrix.package-path }}
34
+ python setup.py sdist
35
+ python setup.py bdist_wheel
36
+ - name: Publish distribution 📦 to Test PyPI
37
+ if: startsWith(github.ref, 'refs/tags') && contains(github.ref, 'test')
38
+ uses: actions/gh-action-pypi-publish@717ba43cfbb0387f6ce311b169a825772f54d295
39
+ with:
40
+ password: ${{ secrets.TEST_PYPI_PASSWORD }}
41
+ repository_url: https://test.pypi.org/legacy/
42
+ packages_dir: ${{ matrix.package-path }}/dist/
43
+ - name: Publish distribution 📦 to Production PyPI
44
+ if: startsWith(github.ref, 'refs/tags') && !contains(github.ref, 'test')
45
+ uses: actions/gh-action-pypi-publish@717ba43cfbb0387f6ce311b169a825772f54d295
46
+ with:
47
+ password: ${{ secrets.PYPI_PASSWORD }}
48
+ packages_dir: ${{ matrix.package-path }}/dist/
.github/workflows/publish_pypi_python_api.yaml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Adapted from https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
2
+ name: Publish Python APIs to PyPI (or TestPyPI)
3
+
4
+ on:
5
+ push:
6
+ tags:
7
+ - "api_release_[0-9]+_test[0-9]+"
8
+ - "api_release_[0-9]+"
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ build-and-publish:
13
+ name: publish to PyPI (or TestPyPI)
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ package-path: [ml-agents-envs]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - name: Set up Python 3.8
22
+ uses: actions/setup-python@v2
23
+ with:
24
+ python-version: 3.8
25
+ - name: Install dependencies
26
+ run: pip install setuptools wheel twine --user
27
+ - name: verify git tag vs. version
28
+ run: |
29
+ cd ${{ matrix.package-path }}
30
+ python setup.py verify
31
+ - name: Build package
32
+ run: |
33
+ cd ${{ matrix.package-path }}
34
+ python setup.py sdist
35
+ python setup.py bdist_wheel
36
+ - name: Publish distribution 📦 to Test PyPI
37
+ if: startsWith(github.ref, 'refs/tags') && contains(github.ref, 'test')
38
+ uses: actions/gh-action-pypi-publish@717ba43cfbb0387f6ce311b169a825772f54d295
39
+ with:
40
+ user: __token__
41
+ password: ${{ secrets.TEST_PYPI_PASSWORD }}
42
+ repository_url: https://test.pypi.org/legacy/
43
+ packages_dir: ${{ matrix.package-path }}/dist/
44
+ - name: Publish distribution 📦 to Production PyPI
45
+ if: startsWith(github.ref, 'refs/tags') && !contains(github.ref, 'test')
46
+ uses: actions/gh-action-pypi-publish@717ba43cfbb0387f6ce311b169a825772f54d295
47
+ with:
48
+ user: __token__
49
+ password: ${{ secrets.PYPI_PASSWORD }}
50
+ packages_dir: ${{ matrix.package-path }}/dist/
.github/workflows/pytest.yml ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: pytest
2
+
3
+ on:
4
+ pull_request:
5
+ paths: # This action will only run if the PR modifies a file in one of these directories
6
+ - 'ml-agents/**'
7
+ - 'ml-agents-envs/**'
8
+ - 'test_constraints*.txt'
9
+ - 'test_requirements.txt'
10
+ - '.github/workflows/pytest.yml'
11
+ push:
12
+ branches:
13
+ - main
14
+ - develop
15
+ - 'release/**'
16
+ workflow_dispatch:
17
+ inputs:
18
+ pytest_markers:
19
+ description: "Restrict which tests to run based on pytest markers"
20
+ required: false
21
+ default: "not slow"
22
+ type: string
23
+ workflow_call:
24
+ inputs:
25
+ pytest_markers:
26
+ required: false
27
+ # Hacky way to make sure we run all tests
28
+ default: "slow or not slow"
29
+ type: string
30
+
31
+ jobs:
32
+ pytest:
33
+ runs-on: ubuntu-latest
34
+ env:
35
+ TEST_ENFORCE_BUFFER_KEY_TYPES: 1
36
+ strategy:
37
+ # If one test in the matrix fails we still want to run the others.
38
+ fail-fast: false
39
+ matrix:
40
+ python-version: [3.8.x, 3.9.x, 3.10.x]
41
+ include:
42
+ - python-version: 3.8.x
43
+ pip_constraints: test_constraints_min_version.txt
44
+ - python-version: 3.9.x
45
+ pip_constraints: test_constraints_mid_version.txt
46
+ - python-version: 3.10.x
47
+ pip_constraints: test_constraints_max_version.txt
48
+ steps:
49
+ - uses: actions/checkout@v2
50
+ - name: Set up Python
51
+ uses: actions/setup-python@v2
52
+ with:
53
+ python-version: ${{ matrix.python-version }}
54
+ - name: Cache pip
55
+ uses: actions/cache@v2
56
+ with:
57
+ # This path is specific to Ubuntu
58
+ path: ~/.cache/pip
59
+ # Look to see if there is a cache hit for the corresponding requirements file
60
+ key: ${{ runner.os }}-pip-${{ hashFiles('ml-agents/setup.py', 'ml-agents-envs/setup.py', 'test_requirements.txt', matrix.pip_constraints) }}
61
+ restore-keys: |
62
+ ${{ runner.os }}-pip-
63
+ ${{ runner.os }}-
64
+ - name: Display Python version
65
+ run: python -c "import sys; print(sys.version)"
66
+ - name: Install dependencies
67
+ run: |
68
+ python -m pip install --upgrade pip
69
+ python -m pip install --upgrade setuptools
70
+ python -m pip install --progress-bar=off -e ./ml-agents-envs -c ${{ matrix.pip_constraints }}
71
+ python -m pip install --progress-bar=off -e ./ml-agents -c ${{ matrix.pip_constraints }}
72
+ python -m pip install --progress-bar=off -r test_requirements.txt -c ${{ matrix.pip_constraints }}
73
+ python -m pip install --progress-bar=off -e ./ml-agents-plugin-examples -c ${{ matrix.pip_constraints }}
74
+ - name: Save python dependencies
75
+ run: |
76
+ pip freeze > pip_versions-${{ matrix.python-version }}.txt
77
+ cat pip_versions-${{ matrix.python-version }}.txt
78
+ - name: Get pytest marker
79
+ id: pytest_marker
80
+ run: |
81
+ if [ "${{ github.event.inputs.pytest_markers }}" != "" ]; then
82
+ echo "::set-output name=markers::${{ github.event.inputs.pytest_markers }}"
83
+ else
84
+ echo "::set-output name=markers::not slow"
85
+ fi
86
+ - name: Run pytest
87
+ run: |
88
+ pytest --cov=ml-agents --cov=ml-agents-envs \
89
+ --cov-report=html --junitxml=junit/test-results-${{ matrix.python-version }}.xml \
90
+ -p no:warnings -v -m "${{ steps.pytest_marker.outputs.markers }}" -n 8
91
+ - name: Upload pytest test results
92
+ uses: actions/upload-artifact@v2
93
+ with:
94
+ name: artifacts-${{ matrix.python-version }}
95
+ path: |
96
+ htmlcov
97
+ pip_versions-${{ matrix.python-version }}.txt
98
+ junit/test-results-${{ matrix.python-version }}.xml
99
+ # Use always() to always run this step to publish test results when there are test failures
100
+ if: ${{ always() }}
.github/workflows/validate_catalog.yaml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Validate catalog-info.yaml file
2
+ name: Validate Catalog-info.yaml
3
+ on:
4
+ pull_request:
5
+ paths:
6
+ - 'catalog-info.yaml'
7
+ push:
8
+ paths:
9
+ - 'catalog-info.yaml'
10
+ branches: [ main ]
11
+
12
+ jobs:
13
+ validate_catalog:
14
+ runs-on: [ubuntu-latest]
15
+ steps:
16
+ - id: 'Checkout'
17
+ uses: actions/checkout@v2
18
+
19
+ - id: 'Validate'
20
+ uses: 'RoadieHQ/backstage-entity-validator@v0.3.2'
21
+
.gitignore ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Output Artifacts (Legacy)
2
+ /models
3
+ /summaries
4
+ # Output Artifacts
5
+ /results
6
+ # Output Builds
7
+ /Builds
8
+
9
+ # Training environments
10
+ /envs
11
+
12
+ # Environemnt logfile
13
+ *Project.log
14
+
15
+ # Custom settings asset
16
+ *.settings.asset*
17
+
18
+ # Visual Studio 2015 cache directory
19
+ /Project/.vs/
20
+
21
+ # Autogenerated VS/MD/Consulo solution and project files
22
+ /com.unity.ml-agentsExportedObj/
23
+ /com.unity.ml-agents.consulo/
24
+ *.csproj
25
+ *.unityproj
26
+ *.sln
27
+ *.suo
28
+ *.tmp
29
+ *.user
30
+ *.userprefs
31
+ *.pidb
32
+ *.booproj
33
+ *.svd
34
+ *.pdb
35
+
36
+ # Unity3D generated meta files
37
+ *.pidb.meta
38
+
39
+ # Unity3D Generated File On Crash Reports
40
+ /com.unity.ml-agents/sysinfo.txt
41
+
42
+ # Builds
43
+ *.apk
44
+ *.unitypackage
45
+ *.app
46
+ *.exe
47
+ *.x86_64
48
+ *.x86
49
+
50
+ # Plugins
51
+ /com.unity.ml-agents/VideoRecorder*
52
+
53
+ # Generated doc folders
54
+ /docs/html
55
+
56
+ # Mac hidden files
57
+ *.DS_Store
58
+ */.ipynb_checkpoints
59
+ */.idea
60
+ *.pyc
61
+ *.idea/misc.xml
62
+ *.idea/modules.xml
63
+ *.idea/
64
+ *.iml
65
+ *.cache
66
+ */build/
67
+ */dist/
68
+ *.egg-info*
69
+ *.eggs*
70
+ *.gitignore.swp
71
+
72
+ # VSCode hidden files
73
+ *.vscode/
74
+
75
+ .DS_Store
76
+ .ipynb_checkpoints
77
+
78
+ # pytest cache
79
+ *.pytest_cache/
80
+
81
+ # Ignore compiled protobuf files.
82
+ *Grpc.Tools*
83
+
84
+ # Ignore PyPi build files.
85
+ dist/
86
+ build/
87
+
88
+ # Python virtual environment
89
+ venv/
90
+ .mypy_cache/
91
+
92
+ # Code coverage report
93
+ .coverage
94
+ coverage.xml
95
+ /htmlcov/
96
+
97
+ **/UserSettings/*
.gitmodules ADDED
File without changes
.pre-commit-config.yaml ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/python/black
3
+ rev: 22.3.0
4
+ hooks:
5
+ - id: black
6
+ exclude: >
7
+ (?x)^(
8
+ .*_pb2.py|
9
+ .*_pb2.pyi|
10
+ .*_pb2_grpc.py
11
+ )$
12
+
13
+ - repo: https://github.com/pre-commit/mirrors-mypy
14
+ rev: v0.991
15
+ hooks:
16
+ - id: mypy
17
+ name: mypy-ml-agents
18
+ files: "ml-agents/.*"
19
+ args: [--ignore-missing-imports, --disallow-incomplete-defs, --no-strict-optional]
20
+ additional_dependencies: [types-PyYAML, types-attrs, types-protobuf, types-setuptools, types-filelock]
21
+ - id: mypy
22
+ name: mypy-ml-agents-envs
23
+ files: "ml-agents-envs/.*"
24
+ # Exclude protobuf files and don't follow them when imported
25
+ exclude: ".*_pb2.py"
26
+ args: [--ignore-missing-imports, --disallow-incomplete-defs, --no-strict-optional]
27
+ additional_dependencies: [types-PyYAML, types-attrs, types-protobuf, types-setuptools, types-filelock]
28
+ - repo: https://github.com/PyCQA/flake8
29
+ rev: 3.9.2
30
+ hooks:
31
+ - id: flake8
32
+ exclude: >
33
+ (?x)^(
34
+ .*_pb2.py|
35
+ .*_pb2_grpc.py
36
+ )$
37
+ # flake8-tidy-imports is used for banned-modules, not actually tidying
38
+ additional_dependencies: [flake8-comprehensions==3.2.2, flake8-tidy-imports==4.1.0, flake8-bugbear==20.1.4]
39
+
40
+ - repo: https://github.com/asottile/pyupgrade
41
+ rev: v2.31.0
42
+ hooks:
43
+ - id: pyupgrade
44
+ args: [--py3-plus, --py36-plus]
45
+ exclude: >
46
+ (?x)^(
47
+ .*_pb2.py|
48
+ .*_pb2_grpc.py
49
+ )$
50
+
51
+ - repo: https://github.com/pre-commit/pre-commit-hooks
52
+ rev: v4.1.0
53
+ hooks:
54
+ - id: mixed-line-ending
55
+ exclude: >
56
+ (?x)^(
57
+ .*cs.meta|
58
+ .*.css|
59
+ .*.meta
60
+ )$
61
+ args: [--fix=lf]
62
+
63
+ - id: trailing-whitespace
64
+ name: trailing-whitespace-markdown
65
+ types: [markdown]
66
+ - id: check-merge-conflict
67
+ args: [--assume-in-merge]
68
+ - id: check-yaml
69
+ # Won't handle the templating in yamato
70
+ exclude: \.yamato/.*
71
+
72
+ - repo: https://github.com/pre-commit/pygrep-hooks
73
+ rev: v1.9.0
74
+ hooks:
75
+ - id: python-check-mock-methods
76
+
77
+ - repo: https://github.com/mattlqx/pre-commit-search-and-replace
78
+ rev: v1.0.5
79
+ hooks:
80
+ - id: search-and-replace
81
+ types: [markdown]
82
+ exclude: ".*localized.*"
83
+
84
+ #- repo: https://github.com/dotnet/format
85
+ # rev: v5.1.225507
86
+ # hooks:
87
+ # - id: dotnet-format
88
+ # entry: dotnet-format whitespace
89
+ # args: [--folder, --include]
90
+
91
+ # "Local" hooks, see https://pre-commit.com/#repository-local-hooks
92
+ - repo: local
93
+ hooks:
94
+ - id: dotnet-format
95
+ name: dotnet-format
96
+ language: system
97
+ entry: dotnet format whitespace --folder --include
98
+ types_or: ["c#"]
99
+ - id: markdown-link-check
100
+ name: markdown-link-check
101
+ entry: utils/run_markdown_link_check.py
102
+ language: script
103
+ types: [markdown]
104
+ # Don't check localized files since their target might not be localized.
105
+ exclude: ".*localized.*"
106
+ # Only run manually, e.g. pre-commit run --hook-stage manual markdown-link-check
107
+ stages: [manual]
108
+ - id: markdown-link-check-full
109
+ name: markdown-link-check-full
110
+ entry: utils/run_markdown_link_check.py
111
+ language: script
112
+ types: [markdown]
113
+ # Don't check localized files since their target might not be localized.
114
+ exclude: ".*localized.*"
115
+ # Only run manually, e.g. pre-commit run --hook-stage manual markdown-link-check-full
116
+ stages: [manual]
117
+ args: [--check-remote]
118
+ - id: validate-versions
119
+ name: validate library versions
120
+ language: script
121
+ entry: utils/validate_versions.py
122
+ files: ".*/__init__.py"
123
+ - id: validate-init-py
124
+ name: validate __init__.py files
125
+ language: script
126
+ entry: utils/validate_inits.py
127
+ types: [python]
128
+ - id: validate-release-links-py
129
+ name: validate release links
130
+ language: script
131
+ entry: utils/validate_release_links.py
132
+ require_serial: true
133
+ - id: generate-markdown-docs
134
+ name: generate markdown docs
135
+ language: python
136
+ entry: ./utils/generate_markdown_docs.py --package_dirs ml-agents-envs ml-agents
137
+ pass_filenames: false
138
+ additional_dependencies: [pyyaml, pydoc-markdown==3.10.1]
.pre-commit-search-and-replace.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ - description: Replace "ML agents toolkit", "ML-Agents toolkit" etc
2
+ search: /ML[ -]Agents toolkit/
3
+ replacement: ML-Agents Toolkit
4
+ insensitive: true
5
+ - description: Replace "the the"
6
+ search: /the the/
7
+ replacement: the
8
+ insensitive: true
.yamato/com.unity.ml-agents-coverage.yml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% metadata_file .yamato/coverage_tests.metafile %}
2
+ ---
3
+ {% for package in coverage_test_packages %}
4
+ {% for editor in coverage_test_editors %}
5
+ {% for platform in coverage_test_platforms %}
6
+ {% capture coverageOptions %} --enable-code-coverage --code-coverage-options 'generateHtmlReport;assemblyFilters:+{{ package.assembly }}'{% endcapture %}
7
+
8
+ test_coverage_{{ package.name }}_{{ platform.name }}_{{ editor.version }}:
9
+ name : Coverage {{ package.name }} test {{ editor.version }} on {{ platform.name }}
10
+ agent:
11
+ type: {{ platform.type }}
12
+ image: {{ platform.image }}
13
+ flavor: {{ platform.flavor}}
14
+ commands:
15
+ - npm install upm-ci-utils@1.27.0 -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
16
+ - upm-ci project test -u {{ editor.version }} --type project-tests --project-path {{ editor.testProject }} --package-filter {{ package.name }} {{ coverageOptions }} --extra-utr-arg "reruncount=2"
17
+ - |
18
+ conda activate python3.8
19
+ python3 ml-agents/tests/yamato/check_coverage_percent.py upm-ci~/test-results/ {{ package.minCoveragePct }}
20
+ artifacts:
21
+ logs:
22
+ paths:
23
+ - "upm-ci~/test-results/**/*"
24
+ dependencies:
25
+ - .yamato/com.unity.ml-agents-pack.yml#pack
26
+ triggers:
27
+ cancel_old_ci: true
28
+ {% if platform.name == "linux" %}
29
+ expression: |
30
+ (pull_request.target eq "main" OR
31
+ pull_request.target eq "develop" OR
32
+ pull_request.target match "release.+") AND
33
+ NOT pull_request.draft AND
34
+ (pull_request.changes.any match "com.unity.ml-agents/**" OR
35
+ pull_request.changes.any match " {{ editor.testProject }}/**" OR
36
+ {% if package.name == "com.unity.ml-agents.extensions" %}
37
+ pull_request.changes.any match "com.unity.ml-agents.extensions/**" OR
38
+ {% endif %}
39
+ pull_request.changes.any match ".yamato/com.unity.ml-agents-coverage.yml")
40
+ {% endif %}
41
+ {% endfor %}
42
+ {% endfor %}
43
+ {% endfor %}
.yamato/com.unity.ml-agents-pack.yml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pack:
2
+ name: Pack
3
+ agent:
4
+ type: Unity::VM
5
+ image: ml-agents/ml-agents-ubuntu-18.04:latest
6
+ flavor: b1.small
7
+ commands:
8
+ - |
9
+ eval "$($HOME/anaconda/bin/conda shell.bash hook)"
10
+ conda activate python3.8
11
+ python3 -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
12
+ unity-downloader-cli -u 2022.3 -c editor --wait --fast
13
+ ./.Editor/Unity -projectPath Project -batchMode -executeMethod Unity.MLAgents.SampleExporter.ExportCuratedSamples -logFile -
14
+ npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
15
+ upm-ci project pack --project-path Project
16
+ artifacts:
17
+ packages:
18
+ paths:
19
+ - "upm-ci~/packages/**/*"
20
+ triggers:
21
+ cancel_old_ci: true
.yamato/com.unity.ml-agents-performance.yml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ test_editors:
2
+ - version: 2022.3
3
+ - version: 2023.1
4
+ ---
5
+ {% for editor in test_editors %}
6
+ Run_Mac_Perfomance_Tests{{ editor.version }}:
7
+ name: Run Mac Performance Tests {{ editor.version }}
8
+ agent:
9
+ type: Unity::VM::osx
10
+ image: package-ci/mac:stable
11
+ flavor: b1.small
12
+ variables:
13
+ UNITY_VERSION: {{ editor.version }}
14
+ commands:
15
+ - python3 -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
16
+ - unity-downloader-cli -u {{ editor.version }} -c editor --wait --fast
17
+ - curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr --output utr
18
+ - chmod +x ./utr
19
+ - ./utr --suite=editor --platform=StandaloneOSX --editor-location=.Editor --testproject=DevProject --artifacts_path=build/test-results --report-performance-data --performance-project-id=com.unity.ml-agents --zero-tests-are-ok=1
20
+ triggers:
21
+ cancel_old_ci: true
22
+ recurring:
23
+ - branch: develop
24
+ frequency: daily
25
+ artifacts:
26
+ logs:
27
+ paths:
28
+ - "build/test-results/**"
29
+ - "*.log"
30
+ {% endfor %}
.yamato/com.unity.ml-agents-promotion.yml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ test_editors:
2
+ - version: 2022.3
3
+ test_platforms:
4
+ - name: win
5
+ type: Unity::VM
6
+ image: package-ci/win10:stable
7
+ flavor: b1.large
8
+ ---
9
+
10
+ {% for editor in test_editors %}
11
+ {% for platform in test_platforms %}
12
+ promotion_test_{{ platform.name }}_{{ editor.version }}:
13
+ name : Promotion Test {{ editor.version }} on {{ platform.name }}
14
+ agent:
15
+ type: {{ platform.type }}
16
+ image: {{ platform.image }}
17
+ flavor: {{ platform.flavor}}
18
+ variables:
19
+ UPMCI_PROMOTION: 1
20
+ commands:
21
+ - npm install upm-ci-utils@1.27.0 -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
22
+ - upm-ci package test --unity-version {{ editor.version }} --package-path com.unity.ml-agents
23
+ artifacts:
24
+ logs:
25
+ paths:
26
+ - "upm-ci~/test-results/**/*"
27
+ dependencies:
28
+ - .yamato/com.unity.ml-agents-pack.yml#pack
29
+ {% endfor %}
30
+ {% endfor %}
31
+
32
+ promotion_test_trigger:
33
+ name: Promotion Tests Trigger
34
+ dependencies:
35
+ {% for editor in test_editors %}
36
+ {% for platform in test_platforms %}
37
+ - .yamato/com.unity.ml-agents-promotion.yml#promotion_test_{{platform.name}}_{{editor.version}}
38
+ {% endfor %}
39
+ {% endfor %}
40
+
41
+
42
+ promote:
43
+ name: Promote to Production
44
+ agent:
45
+ type: Unity::VM
46
+ image: package-ci/win10:stable
47
+ flavor: b1.large
48
+ variables:
49
+ UPMCI_PROMOTION: 1
50
+ commands:
51
+ - npm install upm-ci-utils@1.27.0 -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
52
+ - upm-ci package promote --package-path com.unity.ml-agents
53
+ # triggers:
54
+ # tags:
55
+ # only:
56
+ # - /^(r|R)elease-\d+\.\d+\.\d+(-preview(\.\d+)?)?$/
57
+ artifacts:
58
+ artifacts:
59
+ paths:
60
+ - "upm-ci~/packages/*.tgz"
61
+ dependencies:
62
+ - .yamato/com.unity.ml-agents-pack.yml#pack
63
+ {% for editor in test_editors %}
64
+ {% for platform in test_platforms %}
65
+ - .yamato/com.unity.ml-agents-promotion.yml#promotion_test_{{ platform.name }}_{{ editor.version }}
66
+ {% endfor %}
67
+ {% endfor %}
.yamato/com.unity.ml-agents-publish.yml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ publish:
2
+ name: Publish ML-Agents to Internal Registry
3
+ agent:
4
+ type: Unity::VM
5
+ image: package-ci/win10:stable
6
+ flavor: b1.large
7
+ variables:
8
+ UPMCI_ENABLE_PACKAGE_SIGNING: 1
9
+ commands:
10
+ - npm install upm-ci-utils@1.27.0 -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
11
+ - upm-ci package publish --package-path com.unity.ml-agents
12
+ triggers:
13
+ cancel_old_ci: true
14
+ # tags:
15
+ # only:
16
+ # - /^(r|R)(c|C)-\d+\.\d+\.\d+(-preview(\.\d+)?)?$/
17
+ artifacts:
18
+ artifacts:
19
+ paths:
20
+ - "upm-ci~/packages/*.tgz"
21
+ dependencies:
22
+ - .yamato/com.unity.ml-agents-pack.yml#pack
23
+ - .yamato/com.unity.ml-agents-test.yml#all_package_tests
.yamato/com.unity.ml-agents-test.yml ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% metadata_file .yamato/coverage_tests.metafile %}
2
+ test_editors:
3
+ - version: 2022.3
4
+ # We want some scene tests to run in the DevProject, but packages there only support 2020+
5
+ testProject: Project
6
+ enableNoDefaultPackages: !!bool true
7
+ - version: 2023.1
8
+ testProject: DevProject
9
+ enableNoDefaultPackages: !!bool true
10
+
11
+ trunk_editor:
12
+ - version: trunk
13
+ # Workaround for MLA-1596 - need to make sure we load the right results.
14
+ testProject: DevProject
15
+
16
+ test_platforms:
17
+ - name: win
18
+ type: Unity::VM
19
+ image: package-ci/win10:stable
20
+ flavor: b1.large
21
+ - name: mac
22
+ type: Unity::VM::osx
23
+ image: package-ci/mac:stable
24
+ flavor: b1.large
25
+ - name: linux
26
+ type: Unity::VM
27
+ image: ml-agents/ml-agents-ubuntu-18.04:latest
28
+ flavor: b1.large
29
+
30
+ packages:
31
+ - name: com.unity.ml-agents
32
+ assembly: Unity.ML-Agents
33
+ minCoveragePct: 72
34
+ - name: com.unity.ml-agents.extensions
35
+ assembly: Unity.ML-Agents.Extensions*
36
+ minCoveragePct: 75
37
+ ---
38
+
39
+ all_package_tests:
40
+ name: Run All Combinations of Editors/Platforms Tests
41
+ dependencies:
42
+ {% for coverage_editor in coverage_test_editors %}
43
+ {% for coverage_platform in coverage_test_platforms %}
44
+ {% for coverage_package in coverage_test_packages %}
45
+ - .yamato/com.unity.ml-agents-coverage.yml#test_coverage_{{ coverage_package.name }}_{{ coverage_platform.name }}_{{ coverage_editor.version }}
46
+ {% endfor %}
47
+ {% endfor %}
48
+ {% endfor %}
49
+ {% for editor in test_editors %}
50
+ {% for platform in test_platforms %}
51
+ - .yamato/com.unity.ml-agents-test.yml#test_com.unity.ml-agents_{{ platform.name }}_{{ editor.version }}
52
+ {% endfor %}
53
+ {% endfor %}
54
+ {% for editor in trunk_editor %}
55
+ {% for platform in test_platforms %}
56
+ - .yamato/com.unity.ml-agents-test.yml#test_com.unity.ml-agents_{{ platform.name }}_{{ editor.version }}
57
+ {% endfor %}
58
+ {% endfor %}
59
+ triggers:
60
+ cancel_old_ci: true
61
+ recurring:
62
+ - branch: develop
63
+ frequency: daily
64
+
65
+ {% for package in packages %}
66
+ {% for editor in test_editors %}
67
+ {% for platform in test_platforms %}
68
+
69
+ {% if editor.enableNoDefaultPackages %}
70
+ {% assign noDefaultPackagesOptions = "--extra-create-project-arg='-upmNoDefaultPackages'" %}
71
+ {% else %}
72
+ {% assign noDefaultPackagesOptions = "" %}
73
+ {% endif %}
74
+
75
+ test_{{ package.name }}_{{ platform.name }}_{{ editor.version }}:
76
+ name : {{ package.name }} test {{ editor.version }} on {{ platform.name }}
77
+ agent:
78
+ type: {{ platform.type }}
79
+ image: {{ platform.image }}
80
+ flavor: {{ platform.flavor}}
81
+ commands:
82
+ - npm install upm-ci-utils@1.27.0 -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
83
+ - upm-ci package test -u {{ editor.version }} --package-path {{ package.name }} {{ noDefaultPackagesOptions }} --warnings-as-errors --extra-utr-arg "reruncount=2"
84
+ artifacts:
85
+ logs:
86
+ paths:
87
+ - "upm-ci~/test-results/**/*"
88
+ dependencies:
89
+ - .yamato/com.unity.ml-agents-pack.yml#pack
90
+ {% for coverage_editor in coverage_test_editors %}
91
+ {% for coverage_platform in coverage_test_platforms %}
92
+ {% for coverage_package in coverage_test_packages %}
93
+ - .yamato/com.unity.ml-agents-coverage.yml#test_coverage_{{ coverage_package.name }}_{{ coverage_platform.name }}_{{ coverage_editor.version }}
94
+ {% endfor %}
95
+ {% endfor %}
96
+ {% endfor %}
97
+ triggers:
98
+ cancel_old_ci: true
99
+ {% if platform.name == "linux" %}
100
+ expression: |
101
+ (pull_request.target eq "main" OR
102
+ pull_request.target eq "develop" OR
103
+ pull_request.target match "release.+") AND
104
+ NOT pull_request.draft AND
105
+ (pull_request.changes.any match "com.unity.ml-agents/**" OR
106
+ pull_request.changes.any match " {{ editor.testProject }}/**" OR
107
+ {% if package.name == "com.unity.ml-agents.extensions" %}
108
+ pull_request.changes.any match "com.unity.ml-agents.extensions/**" OR
109
+ {% endif %}
110
+ pull_request.changes.any match ".yamato/com.unity.ml-agents-test.yml")
111
+ {% endif %}
112
+ {% endfor %}
113
+ {% endfor %}
114
+ {% endfor %}
115
+
116
+ {% for package in packages %}
117
+ {% for editor in trunk_editor %}
118
+ {% for platform in test_platforms %}
119
+
120
+ test_{{ package.name }}_{{ platform.name }}_trunk:
121
+ name : {{ package.name }} test {{ editor.version }} on {{ platform.name }}
122
+ agent:
123
+ type: {{ platform.type }}
124
+ image: {{ platform.image }}
125
+ flavor: {{ platform.flavor}}
126
+ commands:
127
+ - |
128
+ {% if platform.name == "linux" %}
129
+ conda activate python3.8
130
+ {% endif %}
131
+ python -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
132
+ unity-downloader-cli -u trunk -c editor --wait --fast
133
+ npm install upm-ci-utils@1.27.0 -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
134
+ upm-ci project test -u {{ editor.version }} --project-path {{ editor.testProject }} --package-filter {{ package.name }} --extra-create-project-arg="-upmNoDefaultPackages" --extra-utr-arg "reruncount=2"
135
+ artifacts:
136
+ logs:
137
+ paths:
138
+ - "upm-ci~/test-results/**/*"
139
+ dependencies:
140
+ - .yamato/com.unity.ml-agents-pack.yml#pack
141
+ {% for coverage_editor in coverage_test_editors %}
142
+ {% for coverage_platform in coverage_test_platforms %}
143
+ {% for coverage_package in coverage_test_packages %}
144
+ - .yamato/com.unity.ml-agents-coverage.yml#test_coverage_{{ coverage_package.name }}_{{ coverage_platform.name }}_{{ coverage_editor.version }}
145
+ {% endfor %}
146
+ {% endfor %}
147
+ {% endfor %}
148
+ triggers:
149
+ cancel_old_ci: true
150
+ {% endfor %}
151
+ {% endfor %}
152
+ {% endfor %}
.yamato/compressed-sensor-test.yml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% metadata_file .yamato/test_versions.metafile %}
2
+ ---
3
+ {% for editor in test_editors %}
4
+ test_compressed_obs_{{ editor.version }}:
5
+ name: Test Compressed Sensor Observation {{ editor.version }}
6
+ agent:
7
+ type: Unity::VM
8
+ image: ml-agents/ml-agents-ubuntu-18.04:latest
9
+ flavor: b1.medium
10
+ variables:
11
+ UNITY_VERSION: {{ editor.version }}
12
+ commands:
13
+ - |
14
+ eval "$($HOME/anaconda/bin/conda shell.bash hook)"
15
+ conda activate python3.8
16
+ python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
17
+ python -u -m ml-agents.tests.yamato.setup_venv
18
+ python ml-agents/tests/yamato/scripts/run_compressed_sensor.py --env=artifacts/testPlayer-TestGridCompressed
19
+ python ml-agents/tests/yamato/scripts/run_compressed_sensor.py --env=artifacts/testPlayer-TestTextureCompressed
20
+ dependencies:
21
+ - .yamato/standalone-build-test.yml#test_linux_standalone_{{ editor.version }}
22
+ triggers:
23
+ cancel_old_ci: true
24
+ {% if editor.extra_test == "sensor" %}
25
+ expression: |
26
+ (pull_request.target eq "main" OR
27
+ pull_request.target eq "develop" OR
28
+ pull_request.target match "release.+") AND
29
+ NOT pull_request.draft AND
30
+ (pull_request.changes.any match "com.unity.ml-agents/**" OR
31
+ pull_request.changes.any match "com.unity.ml-agents.extensions/**" OR
32
+ pull_request.changes.any match "Project/**" OR
33
+ pull_request.changes.any match "ml-agents/tests/yamato/**" OR
34
+ pull_request.changes.any match "ml-agents-envs/**" OR
35
+ pull_request.changes.any match ".yamato/compressed-sensor-test.yml") AND
36
+ NOT pull_request.changes.all match "**/*.md"
37
+ {% endif %}
38
+ {% endfor %}
.yamato/coverage_tests.metafile ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ coverage_test_editors:
2
+ - version: 2022.3
3
+ testProject: DevProject
4
+
5
+ coverage_test_platforms:
6
+ - name: linux
7
+ type: Unity::VM
8
+ image: ml-agents/ml-agents-ubuntu-18.04:latest
9
+ flavor: b1.medium
10
+
11
+ coverage_test_packages:
12
+ - name: com.unity.ml-agents
13
+ assembly: Unity.ML-Agents
14
+ minCoveragePct: 72
15
+ - name: com.unity.ml-agents.extensions
16
+ assembly: Unity.ML-Agents.Extensions*
17
+ minCoveragePct: 75
.yamato/gym-interface-test.yml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% metadata_file .yamato/test_versions.metafile %}
2
+ ---
3
+ {% for editor in test_editors %}
4
+ test_gym_interface_{{ editor.version }}:
5
+ name: Test Linux Gym Interface {{ editor.version }}
6
+ agent:
7
+ type: Unity::VM
8
+ image: ml-agents/ml-agents-ubuntu-18.04:latest
9
+ flavor: b1.medium
10
+ variables:
11
+ UNITY_VERSION: {{ editor.version }}
12
+ commands:
13
+ - |
14
+ eval "$($HOME/anaconda/bin/conda shell.bash hook)"
15
+ conda activate python3.8
16
+ python -m pip install wheel --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
17
+ python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
18
+ python -u -m ml-agents.tests.yamato.setup_venv
19
+ python ml-agents/tests/yamato/scripts/run_gym.py --env=artifacts/testPlayer-Basic
20
+ dependencies:
21
+ - .yamato/standalone-build-test.yml#test_linux_standalone_{{ editor.version }}
22
+ triggers:
23
+ cancel_old_ci: true
24
+ {% if editor.extra_test == "gym" %}
25
+ expression: |
26
+ (pull_request.target eq "main" OR
27
+ pull_request.target eq "develop" OR
28
+ pull_request.target match "release.+") AND
29
+ NOT pull_request.draft AND
30
+ (pull_request.changes.any match "com.unity.ml-agents/**" OR
31
+ pull_request.changes.any match "Project/**" OR
32
+ pull_request.changes.any match "ml-agents/tests/yamato/**" OR
33
+ pull_request.changes.any match "ml-agents-envs/**" OR
34
+ pull_request.changes.any match ".yamato/gym-interface-test.yml") AND
35
+ NOT pull_request.changes.all match "**/*.md"
36
+ {% endif %}
37
+ {% endfor %}
.yamato/protobuf-generation-test.yml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ test_linux_protobuf_generation:
2
+ name: Protobuf Generation Tests
3
+ agent:
4
+ type: Unity::VM
5
+ image: ml-agents/ml-agents-ubuntu-18.04:latest
6
+ flavor: b1.large
7
+ variables:
8
+ GRPC_VERSION: "1.14.1"
9
+ CS_PROTO_PATH: "com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects"
10
+ commands:
11
+ - |
12
+ sudo apt-get update && sudo apt-get install -y nuget
13
+ eval "$($HOME/anaconda/bin/conda shell.bash hook)"
14
+ conda activate python3.8
15
+ nuget install Grpc.Tools -Version $GRPC_VERSION -OutputDirectory protobuf-definitions/
16
+ python3 -m pip install --upgrade pip --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
17
+ python3 -m pip install grpcio==1.28.1 grpcio-tools==1.13.0 protobuf==3.11.3 six==1.14.0 mypy-protobuf==1.16.0 --progress-bar=off --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
18
+ pushd protobuf-definitions
19
+ chmod +x Grpc.Tools.$GRPC_VERSION/tools/linux_x64/protoc
20
+ chmod +x Grpc.Tools.$GRPC_VERSION/tools/linux_x64/grpc_csharp_plugin
21
+ COMPILER=Grpc.Tools.$GRPC_VERSION/tools/linux_x64 ./make.sh
22
+ popd
23
+ mkdir -p artifacts
24
+ touch artifacts/proto.patch
25
+ git diff --exit-code -- :/ ":(exclude,top)$CS_PROTO_PATH/*.meta" \
26
+ || { GIT_ERR=$?; echo "protobufs need to be regenerated, apply the patch uploaded to artifacts."; \
27
+ echo "Apply the patch with the command 'git apply proto.patch'"; \
28
+ git diff -- :/ ":(exclude,top)$CS_PROTO_PATH/*.meta" > ../artifacts/proto.patch; exit $GIT_ERR; }
29
+ triggers:
30
+ cancel_old_ci: true
31
+ expression: |
32
+ (pull_request.target eq "main" OR
33
+ pull_request.target eq "develop" OR
34
+ pull_request.target match "release.+") AND
35
+ NOT pull_request.draft AND
36
+ (pull_request.changes.any match "protobuf-definitions/**" OR
37
+ pull_request.changes.any match "com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects/**" OR
38
+ pull_request.changes.any match "ml-agents-envs/mlagents_envs/communicator_objects/**" OR
39
+ pull_request.changes.any match ".yamato/protobuf-generation-test.yml") AND
40
+ NOT pull_request.changes.all match "protobuf-definitions/**/*.md"
41
+ artifacts:
42
+ patch:
43
+ paths:
44
+ - "artifacts/*.*"
.yamato/pytest-gpu.yml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pytest_gpu:
2
+ name: Pytest GPU
3
+ agent:
4
+ type: Unity::VM::GPU
5
+ image: ml-agents/ml-agents-ubuntu-18.04:latest
6
+ flavor: b1.large
7
+ commands:
8
+ - |
9
+ eval "$($HOME/anaconda/bin/conda shell.bash hook)"
10
+ conda activate python3.8
11
+ python3 -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
12
+ python3 -u -m ml-agents.tests.yamato.setup_venv
13
+ python3 -m pip install --progress-bar=off -r test_requirements.txt --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
14
+ python3 -m pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
15
+ if python -c "exec('import torch \nif not torch.cuda.is_available(): raise')" &> /dev/null; then
16
+ echo 'all good'
17
+ else
18
+ exit 1
19
+ fi
20
+ python3 -m pytest -m "not slow" --junitxml=junit/test-results.xml -p no:warnings
21
+ triggers:
22
+ cancel_old_ci: true
23
+ expression: |
24
+ (push.branch eq "main" OR
25
+ push.branch eq "develop" OR
26
+ push.branch match "release.+") AND
27
+ push.changes.any match "ml-agents/**" AND
28
+ NOT push.changes.all match "**/*.md"
29
+ artifacts:
30
+ logs:
31
+ paths:
32
+ - "artifacts/standalone_build.txt"
.yamato/python-ll-api-test.yml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% metadata_file .yamato/test_versions.metafile %}
2
+ ---
3
+ {% for editor in test_editors %}
4
+ test_linux_ll_api_{{ editor.version }}:
5
+ name: Test Linux LL-API {{ editor.version }}
6
+ agent:
7
+ type: Unity::VM
8
+ image: ml-agents/ml-agents-ubuntu-18.04:latest
9
+ flavor: b1.medium
10
+ variables:
11
+ UNITY_VERSION: {{ editor.version }}
12
+ commands:
13
+ - |
14
+ eval "$($HOME/anaconda/bin/conda shell.bash hook)"
15
+ conda activate python3.8
16
+ python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
17
+ python -u -m ml-agents.tests.yamato.setup_venv
18
+ python ml-agents/tests/yamato/scripts/run_llapi.py
19
+ python ml-agents/tests/yamato/scripts/run_llapi.py --env=artifacts/testPlayer-Basic
20
+ python ml-agents/tests/yamato/scripts/run_llapi.py --env=artifacts/testPlayer-WallJump
21
+ python ml-agents/tests/yamato/scripts/run_llapi.py --env=artifacts/testPlayer-Match3
22
+ dependencies:
23
+ - .yamato/standalone-build-test.yml#test_linux_standalone_{{ editor.version }}
24
+ triggers:
25
+ cancel_old_ci: true
26
+ {% if editor.extra_test == "llapi" %}
27
+ expression: |
28
+ (pull_request.target eq "main" OR
29
+ pull_request.target eq "develop" OR
30
+ pull_request.target match "release.+") AND
31
+ NOT pull_request.draft AND
32
+ (pull_request.changes.any match "com.unity.ml-agents/**" OR
33
+ pull_request.changes.any match "Project/**" OR
34
+ pull_request.changes.any match "ml-agents/tests/yamato/**" OR
35
+ pull_request.changes.any match "ml-agents-envs/**" OR
36
+ pull_request.changes.any match ".yamato/python-ll-api-test.yml") AND
37
+ NOT pull_request.changes.all match "**/*.md"
38
+ {% endif %}
39
+ {% endfor %}
.yamato/sonar-python-package.yml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ csharp:
2
+ name: Sonarqube Scan for ml-agents python repo
3
+ agent:
4
+ type: Unity::metal::macmini
5
+ image: package-ci/mac:v1.8.1-822785
6
+ flavor: m1.mac
7
+ variables:
8
+ SONARQUBE_PROJECT_KEY: ai-ml-agents-toolkit
9
+ TARGET_BRANCH: develop
10
+ commands:
11
+ - npm install shellcheck --save-dev
12
+ - npm install upm-ci-utils@1.27.0 -g --registry https://artifactory.prd.it.unity3d.com/artifactory/api/npm/upm-npm
13
+ - curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-macosx.zip -o sonar-scanner-cli-macosx.zip -L
14
+ - unzip sonar-scanner-cli-macosx.zip -d ~/sonar-scanner-cli
15
+ - ~/sonar-scanner-cli/sonar-scanner-4.7.0.2747-macosx/bin/sonar-scanner -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY -Dsonar.sources=ml-agents-env -Dsonar.sources=ml-agents -Dsonar.sources=ml-agents-plugin-examples -Dsonar.sources=ml-agents-trainer-plugin -Dsonar.sources=utils -Dsonar.host.url=$SONARQUBE_URL -Dsonar.login=$SONARQUBE_TOKEN -Dsonar.branch.name=$TARGET_BRANCH -Dsonar.scm.provider=git
16
+ triggers:
17
+ cancel_old_ci: true
18
+ expression: |
19
+ ((pull_request.target eq "main" OR pull_request.target eq "develop" OR pull_request.target match "release.+")
20
+ AND NOT pull_request.push.changes.all match "**/*.md") OR
21
+ (push.branch eq "main" OR push.branch eq "develop")
.yamato/standalone-build-test.yml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% metadata_file .yamato/test_versions.metafile %}
2
+ ---
3
+ {% for editor in test_editors %}
4
+ test_linux_standalone_{{ editor.version }}:
5
+ name: Test Linux Standalone {{ editor.version }}
6
+ agent:
7
+ type: Unity::VM
8
+ image: ml-agents/ml-agents-ubuntu-18.04:latest
9
+ flavor: b1.large
10
+ variables:
11
+ UNITY_VERSION: {{ editor.version }}
12
+ commands:
13
+ - |
14
+ eval "$($HOME/anaconda/bin/conda shell.bash hook)"
15
+ conda activate python3.8
16
+ python3 -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
17
+ python3 -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
18
+ unity-downloader-cli -u {{ editor.version }} -c editor --wait --fast
19
+ python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux
20
+ python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/Examples/Basic/Scenes/Basic.unity
21
+ python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/Examples/Match3/Scenes/Match3.unity
22
+ python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/Examples/WallJump/Scenes/WallJump.unity
23
+ python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/TestScenes/TestCompressedGrid/TestGridCompressed.unity
24
+ python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/TestScenes/TestCompressedTexture/TestTextureCompressed.unity
25
+ triggers:
26
+ cancel_old_ci: true
27
+ expression: |
28
+ (pull_request.target eq "main" OR
29
+ pull_request.target eq "develop" OR
30
+ pull_request.target match "release.+") AND
31
+ NOT pull_request.draft AND
32
+ (pull_request.changes.any match "com.unity.ml-agents/**" OR
33
+ pull_request.changes.any match "com.unity.ml-agents.extensions/**" OR
34
+ pull_request.changes.any match ".yamato/standalone-build-test.yml") AND
35
+ NOT pull_request.changes.all match "**/*.md"
36
+ artifacts:
37
+ logs:
38
+ paths:
39
+ - "artifacts/standalone_build.txt"
40
+ standalonebuild:
41
+ paths:
42
+ - "artifacts/testPlayer*/**"
43
+ - "artifacts/**/UnityPlayer.so"
44
+ {% endfor %}
.yamato/standalone-build-webgl-test.yml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% capture editor_version %}2022.3{% endcapture %}
2
+ test_webgl_standalone_{{ editor_version }}:
3
+ name: Test WebGL Standalone {{ editor_version }}
4
+ agent:
5
+ type: Unity::VM
6
+ image: ml-agents/ml-agents-ubuntu-18.04:latest
7
+ flavor: b1.large
8
+ variables:
9
+ UNITY_VERSION: {{ editor_version }}
10
+ commands:
11
+ - |
12
+ eval "$($HOME/anaconda/bin/conda shell.bash hook)"
13
+ conda activate python3.8
14
+ python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
15
+ python -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
16
+ unity-downloader-cli -u {{ editor_version }} -c editor -c WebGL --wait --fast
17
+ python -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=webgl
18
+ triggers:
19
+ cancel_old_ci: true
20
+ recurring:
21
+ - branch: develop
22
+ frequency: weekly
23
+ artifacts:
24
+ logs:
25
+ paths:
26
+ - "artifacts/standalone_build.txt"
27
+ standalonebuild:
28
+ paths:
29
+ - "artifacts/testPlayer*/**"
30
+ - "artifacts/**/UnityPlayer.so"
.yamato/test_versions.metafile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # List of editor versions for standalone-build-test and its dependencies.
2
+ # We always run training-int-tests for all versions of the editor
3
+ # For each "other" test, we only run it against a single version of the
4
+ # editor to reduce the number of yamato jobs
5
+ test_editors:
6
+ - version: 2022.3
7
+ extra_test: gym
8
+ - version: 2023.1
9
+ extra_test: sensor
10
+ - version: trunk
11
+ extra_test: llapi
.yamato/training-int-tests.yml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% metadata_file .yamato/test_versions.metafile %}
2
+ ---
3
+ {% for editor in test_editors %}
4
+ test_linux_training_int_{{ editor.version }}:
5
+ name: Test Linux Fast Training {{ editor.version }}
6
+ agent:
7
+ type: Unity::VM
8
+ image: ml-agents/ml-agents-ubuntu-18.04:latest
9
+ flavor: b1.medium
10
+ variables:
11
+ UNITY_VERSION: {{ editor.version }}
12
+ commands:
13
+ - |
14
+ eval "$($HOME/anaconda/bin/conda shell.bash hook)"
15
+ conda activate python3.8
16
+ python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
17
+ python -u -m ml-agents.tests.yamato.training_int_tests
18
+ dependencies:
19
+ - .yamato/standalone-build-test.yml#test_linux_standalone_{{ editor.version }}
20
+ triggers:
21
+ cancel_old_ci: true
22
+ expression: |
23
+ (pull_request.target eq "main" OR
24
+ pull_request.target eq "develop" OR
25
+ pull_request.target match "release.+") AND
26
+ NOT pull_request.draft AND
27
+ (pull_request.changes.any match "com.unity.ml-agents/**" OR
28
+ pull_request.changes.any match "com.unity.ml-agents.extensions/**" OR
29
+ pull_request.changes.any match "Project/**" OR
30
+ pull_request.changes.any match "ml-agents/**" OR
31
+ pull_request.changes.any match "ml-agents-envs/**" OR
32
+ pull_request.changes.any match ".yamato/training-int-tests.yml") AND
33
+ NOT pull_request.changes.all match "**/*.md"
34
+ artifacts:
35
+ logs:
36
+ paths:
37
+ - "artifacts/standalone_build.txt"
38
+ - "artifacts/inference.nn.txt"
39
+ - "artifacts/inference.onnx.txt"
40
+ standalonebuild:
41
+ paths:
42
+ - "artifacts/testPlayer*/**"
43
+ - "artifacts/models/**"
44
+ {% endfor %}
CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ml-agents@unity3d.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
71
+ version 1.4, available at
72
+ https://www.contributor-covenant.org/version/1/4/code-of-conduct/
73
+
74
+ [homepage]: https://www.contributor-covenant.org
DevProject/.gitignore ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /[Ll]ibrary/
2
+ /Logs/
3
+ /[Tt]emp/
4
+ /[Oo]bj/
5
+ /[Bb]uild/
6
+ /[Bb]uilds/
7
+ /Assets/AssetStoreTools*
8
+ /Assets/Plugins*
9
+ /Assets/Demonstrations*
10
+ /Assets/ML-Agents/Timers*
11
+ /csharp_timers.json
12
+ /CodeCoverage/
13
+
14
+ # Environemnt logfile
15
+ *Project.log
16
+
17
+ # Visual Studio 2015 cache directory
18
+ /.vs/
19
+
20
+ # Autogenerated VS/MD/Consulo solution and project files
21
+ /ProjectExportedObj/
22
+ /Project.consulo/
23
+ *.csproj
24
+ *.unityproj
25
+ *.sln
26
+ *.suo
27
+ *.tmp
28
+ *.user
29
+ *.userprefs
30
+ *.pidb
31
+ *.booproj
32
+ *.svd
33
+ *.pdb
34
+
35
+ # Unity3D generated meta files
36
+ *.pidb.meta
37
+
38
+ # Unity3D Generated File On Crash Reports
39
+ /sysinfo.txt
40
+
41
+ # Builds
42
+ *.apk
43
+ *.unitypackage
44
+ *.app
45
+ *.exe
46
+ *.x86_64
47
+ *.x86
48
+
49
+ # Plugins
50
+ /Assets/VideoRecorder*
51
+
52
+ # Mac hidden files
53
+ *.DS_Store
54
+ */.ipynb_checkpoints
55
+ */.idea
56
+ *.pyc
57
+ *.idea/misc.xml
58
+ *.idea/modules.xml
59
+ *.idea/
60
+ *.iml
61
+ *.cache
62
+ */build/
63
+ */dist/
64
+ *.egg-info*
65
+ *.eggs*
66
+ *.gitignore.swp
67
+
68
+ # VSCode hidden files
69
+ *.vscode/
70
+
71
+ .DS_Store
DevProject/Assets/ML-Agents.meta ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 8498a7556d0b348cbaff70bd8635db8b
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
DevProject/Assets/ML-Agents/Scripts.meta ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 45f48c01abd5d47048bc3edcc6db1dd0
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
DevProject/Assets/ML-Agents/Scripts/Tests.meta ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: eb96b88fc6ae14a41949d1bd75e68d38
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
DevProject/Assets/ML-Agents/Scripts/Tests/Editor.meta ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: dc5370caac53244599df51d5c6d39876
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
DevProject/Assets/ML-Agents/Scripts/Tests/Editor/Editor.asmdef ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "Unity.ML-Agents.DevTests.Editor",
3
+ "references": [
4
+ "Unity.ML-Agents.Editor",
5
+ "Unity.ML-Agents",
6
+ "Unity.Barracuda",
7
+ "Unity.ML-Agents.CommunicatorObjects",
8
+ "Unity.PerformanceTesting"
9
+ ],
10
+ "optionalUnityReferences": [
11
+ "TestAssemblies"
12
+ ],
13
+ "includePlatforms": [
14
+ "Editor"
15
+ ],
16
+ "excludePlatforms": [],
17
+ "allowUnsafeCode": false,
18
+ "overrideReferences": true,
19
+ "precompiledReferences": [
20
+ "System.IO.Abstractions.dll",
21
+ "System.IO.Abstractions.TestingHelpers.dll",
22
+ "Google.Protobuf.dll"
23
+ ],
24
+ "autoReferenced": false,
25
+ "defineConstraints": [
26
+ "UNITY_INCLUDE_TESTS"
27
+ ]
28
+ }
DevProject/Assets/ML-Agents/Scripts/Tests/Editor/Editor.asmdef.meta ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 5b142e67c2d6b4b1e928e4d54f01a596
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
DevProject/Assets/ML-Agents/Scripts/Tests/Editor/MLAgentsSettings.meta ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 1fc80f44976bc4177a9afaa0a38abab3
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
DevProject/Assets/ML-Agents/Scripts/Tests/Editor/MLAgentsSettings/MLAgentsSettingsTests.cs ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using System;
2
+ using System.IO;
3
+ using System.Linq;
4
+ using System.Reflection;
5
+ using NUnit.Framework;
6
+ using UnityEditor;
7
+ using UnityEngine;
8
+ using Unity.MLAgents;
9
+ using Unity.MLAgents.Editor;
10
+
11
+
12
+ namespace MLAgentsExamples.Tests.Settings
13
+ {
14
+ [TestFixture]
15
+ public class MLAgentsSettingsTests
16
+ {
17
+ string EditorBuildSettingsConfigKey = MLAgentsSettingsManager.EditorBuildSettingsConfigKey;
18
+ string tempSettingsRootPath = "Assets/ML-Agents/Scripts/Tests/Editor/MLAgentsSettings";
19
+ MLAgentsSettings storedConfigObject;
20
+ [SetUp]
21
+ public void SetUp()
22
+ {
23
+ if (EditorBuildSettings.TryGetConfigObject(EditorBuildSettingsConfigKey,
24
+ out MLAgentsSettings settingsAsset))
25
+ {
26
+ if (settingsAsset != null)
27
+ {
28
+ storedConfigObject = settingsAsset;
29
+ EditorBuildSettings.RemoveConfigObject(EditorBuildSettingsConfigKey);
30
+ }
31
+ }
32
+ MLAgentsSettingsManager.Destroy();
33
+ ClearSettingsAssets();
34
+ }
35
+
36
+ [TearDown]
37
+ public void TearDown()
38
+ {
39
+ if (storedConfigObject != null)
40
+ {
41
+ EditorBuildSettings.AddConfigObject(EditorBuildSettingsConfigKey, storedConfigObject, true);
42
+ storedConfigObject = null;
43
+ }
44
+ MLAgentsSettingsManager.Destroy();
45
+ ClearSettingsAssets();
46
+ }
47
+
48
+ internal void ClearSettingsAssets()
49
+ {
50
+ var assetsGuids = AssetDatabase.FindAssets("t:MLAgentsSettings", new string[] { tempSettingsRootPath });
51
+ foreach (var guid in assetsGuids)
52
+ {
53
+ var path = AssetDatabase.GUIDToAssetPath(guid);
54
+ AssetDatabase.DeleteAsset(path);
55
+ }
56
+ }
57
+
58
+ [Test]
59
+ public void TestMLAgentsSettingsManager()
60
+ {
61
+ Assert.AreNotEqual(null, MLAgentsSettingsManager.Settings);
62
+ Assert.AreEqual(5004, MLAgentsSettingsManager.Settings.EditorPort); // default port
63
+ MLAgentsSettingsManager.Settings.EditorPort = 6000;
64
+ Assert.AreEqual(6000, MLAgentsSettingsManager.Settings.EditorPort);
65
+
66
+ var settingsObject = ScriptableObject.CreateInstance<MLAgentsSettings>();
67
+ settingsObject.EditorPort = 7000;
68
+ var tempSettingsAssetPath = tempSettingsRootPath + "/test.mlagents.settings.asset";
69
+ AssetDatabase.CreateAsset(settingsObject, tempSettingsAssetPath);
70
+ EditorBuildSettings.AddConfigObject(EditorBuildSettingsConfigKey, settingsObject, true);
71
+ // destroy manager instantiated as a side effect by accessing MLAgentsSettings directly without manager
72
+ MLAgentsSettingsManager.Destroy();
73
+ Assert.AreEqual(7000, MLAgentsSettingsManager.Settings.EditorPort);
74
+ }
75
+
76
+ // A mock class that can invoke private methods/fields in MLAgentsSettingsProvider
77
+ internal class MockSettingsProvider
78
+ {
79
+ public MLAgentsSettingsProvider Instance
80
+ {
81
+ get
82
+ {
83
+ return (MLAgentsSettingsProvider)typeof(MLAgentsSettingsProvider).GetField("s_Instance",
84
+ BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
85
+ }
86
+ }
87
+
88
+ public MLAgentsSettings Settings
89
+ {
90
+ get
91
+ {
92
+ return (MLAgentsSettings)typeof(MLAgentsSettingsProvider).GetField("m_Settings",
93
+ BindingFlags.Instance | BindingFlags.NonPublic).GetValue(Instance);
94
+ }
95
+ }
96
+
97
+ public void CreateMLAgentsSettingsProvider()
98
+ {
99
+ MLAgentsSettingsProvider.CreateMLAgentsSettingsProvider();
100
+ }
101
+
102
+ public void Reinitialize()
103
+ {
104
+ var method = typeof(MLAgentsSettingsProvider).GetMethod("Reinitialize",
105
+ BindingFlags.Instance | BindingFlags.NonPublic);
106
+ method.Invoke(Instance, null);
107
+ }
108
+
109
+ public string[] FindSettingsInProject()
110
+ {
111
+ var method = typeof(MLAgentsSettingsProvider).GetMethod("FindSettingsInProject",
112
+ BindingFlags.Static | BindingFlags.NonPublic);
113
+ return (string[])method.Invoke(null, null);
114
+ }
115
+
116
+ public void CreateNewSettingsAsset(string relativePath)
117
+ {
118
+ var method = typeof(MLAgentsSettingsProvider).GetMethod("CreateNewSettingsAsset",
119
+ BindingFlags.Static | BindingFlags.NonPublic);
120
+ method.Invoke(null, new object[] { relativePath });
121
+ }
122
+ }
123
+
124
+ [Test]
125
+ public void TestMLAgentsSettingsProviderCreateAsset()
126
+ {
127
+ var mockProvider = new MockSettingsProvider();
128
+ mockProvider.CreateMLAgentsSettingsProvider();
129
+ Assert.AreNotEqual(null, mockProvider.Instance);
130
+
131
+ // mimic MLAgentsSettingsProvider.OnActivate()
132
+ MLAgentsSettingsManager.OnSettingsChange += mockProvider.Reinitialize;
133
+
134
+ mockProvider.Instance.InitializeWithCurrentSettings();
135
+ Assert.AreEqual(0, mockProvider.FindSettingsInProject().Length);
136
+
137
+ var tempSettingsAssetPath1 = tempSettingsRootPath + "/test.mlagents.settings.asset";
138
+ mockProvider.CreateNewSettingsAsset(tempSettingsAssetPath1);
139
+ Assert.AreEqual(1, mockProvider.FindSettingsInProject().Length);
140
+ Assert.AreEqual(5004, mockProvider.Settings.EditorPort);
141
+ MLAgentsSettingsManager.Settings.EditorPort = 6000; // change to something not default
142
+ // callback should update the field in provider
143
+ Assert.AreEqual(6000, mockProvider.Settings.EditorPort);
144
+
145
+ var tempSettingsAssetPath2 = tempSettingsRootPath + "/test2.mlagents.settings.asset";
146
+ mockProvider.CreateNewSettingsAsset(tempSettingsAssetPath2);
147
+ Assert.AreEqual(2, mockProvider.FindSettingsInProject().Length);
148
+ // manager should set to the new (default) one, not the previous modified one
149
+ Assert.AreEqual(5004, MLAgentsSettingsManager.Settings.EditorPort);
150
+
151
+ // mimic MLAgentsSettingsProvider.OnDeactivate()
152
+ MLAgentsSettingsManager.OnSettingsChange -= mockProvider.Reinitialize;
153
+ mockProvider.Instance.Dispose();
154
+ }
155
+
156
+ [Test]
157
+ public void TestMLAgentsSettingsProviderLoadAsset()
158
+ {
159
+ var mockProvider = new MockSettingsProvider();
160
+ var tempSettingsAssetPath1 = tempSettingsRootPath + "/test.mlagents.settings.asset";
161
+ mockProvider.CreateNewSettingsAsset(tempSettingsAssetPath1);
162
+ MLAgentsSettingsManager.Settings.EditorPort = 8000; // change to something not default
163
+
164
+ mockProvider.Instance?.Dispose();
165
+ MLAgentsSettingsManager.Destroy();
166
+
167
+ mockProvider.CreateMLAgentsSettingsProvider();
168
+ Assert.AreEqual(8000, MLAgentsSettingsManager.Settings.EditorPort);
169
+ }
170
+ }
171
+ }
DevProject/Assets/ML-Agents/Scripts/Tests/Editor/MLAgentsSettings/MLAgentsSettingsTests.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 44777c287385449678640ce8e4acc3ae
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
DevProject/Assets/ML-Agents/Scripts/Tests/Editor/Performance.meta ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: fb5960f38a3fc42e8a6b52c9bf47d83d
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
DevProject/Assets/ML-Agents/Scripts/Tests/Editor/Performance/SensorPerformanceTests.cs ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using NUnit.Framework;
2
+ using Unity.MLAgents;
3
+ using Unity.MLAgents.Actuators;
4
+ using Unity.MLAgents.Policies;
5
+ using Unity.MLAgents.Sensors;
6
+ using Unity.MLAgents.Sensors.Reflection;
7
+ using Unity.PerformanceTesting;
8
+ using UnityEngine;
9
+
10
+ namespace MLAgentsExamples.Tests.Performance
11
+ {
12
+ [TestFixture]
13
+ public class SensorPerformanceTests
14
+ {
15
+ string[] s_Markers =
16
+ {
17
+ "root.InitializeSensors",
18
+ "root.AgentSendState.CollectObservations",
19
+ "root.AgentSendState.RequestDecision"
20
+ };
21
+ const int k_NumAgentSteps = 10;
22
+ const int k_MeasurementCount = 25;
23
+ const int k_MarkerTestSteps = 10;
24
+
25
+ [SetUp]
26
+ public void SetUp()
27
+ {
28
+ // Step a dummy agent here, so that we don't time the Academy initialization connection attempt and
29
+ // any other static setup costs.
30
+ RunAgent<DummyAgent>(1, 0, ObservableAttributeOptions.ExamineAll);
31
+ }
32
+
33
+ /// <summary>
34
+ /// Simple Agent just used for "burning in" the Academy for testing.
35
+ /// </summary>
36
+ class DummyAgent : Agent
37
+ {
38
+ public override void CollectObservations(VectorSensor sensor)
39
+ {
40
+ }
41
+
42
+ public override void Heuristic(in ActionBuffers actionsOut)
43
+ {
44
+ }
45
+ }
46
+
47
+ /// <summary>
48
+ /// Agent used for performance testing that uses the CollectObservations interface.
49
+ /// </summary>
50
+ class CollectObservationsAgent : Agent
51
+ {
52
+ public override void CollectObservations(VectorSensor sensor)
53
+ {
54
+ sensor.AddObservation(new Vector3(1, 2, 3));
55
+ sensor.AddObservation(new Quaternion(1, 2, 3, 4));
56
+ }
57
+
58
+ public override void Heuristic(in ActionBuffers actionsOut)
59
+ {
60
+ }
61
+ }
62
+
63
+ /// <summary>
64
+ /// Agent used for performance testing that uses the ObservableAttributes on fields.
65
+ /// </summary>
66
+ class ObservableFieldAgent : Agent
67
+ {
68
+ [Observable]
69
+ public Vector3 Vector3Field = new Vector3(1, 2, 3);
70
+
71
+ [Observable]
72
+ public Quaternion QuaternionField = new Quaternion(1, 2, 3, 4);
73
+
74
+ public override void Heuristic(in ActionBuffers actionsOut)
75
+ {
76
+ }
77
+ }
78
+
79
+ /// <summary>
80
+ /// Agent used for performance testing that uses the ObservableAttributes on properties.
81
+ /// </summary>
82
+ class ObservablePropertyAgent : Agent
83
+ {
84
+ Vector3 m_Vector3Field = new Vector3(1, 2, 3);
85
+
86
+ [Observable]
87
+ Vector3 Vector3Property
88
+ {
89
+ get { return m_Vector3Field; }
90
+ }
91
+
92
+ Quaternion m_QuaternionField = new Quaternion(1, 2, 3, 4);
93
+
94
+ [Observable]
95
+ Quaternion QuaternionProperty
96
+ {
97
+ get { return m_QuaternionField; }
98
+ }
99
+
100
+ public override void Heuristic(in ActionBuffers actionsOut)
101
+ {
102
+ }
103
+ }
104
+
105
+ void RunAgent<T>(int numSteps, int obsSize, ObservableAttributeOptions obsOptions) where T : Agent
106
+ {
107
+ var agentGameObj = new GameObject();
108
+ var agent = agentGameObj.AddComponent<T>();
109
+
110
+ var behaviorParams = agent.GetComponent<BehaviorParameters>();
111
+ behaviorParams.BrainParameters.VectorObservationSize = obsSize;
112
+ behaviorParams.ObservableAttributeHandling = obsOptions;
113
+ agent.Awake();
114
+ agent.LazyInitialize();
115
+ for (var i = 0; i < numSteps; i++)
116
+ {
117
+ agent.RequestDecision();
118
+ Academy.Instance.EnvironmentStep();
119
+ }
120
+ Object.DestroyImmediate(agentGameObj);
121
+ }
122
+
123
+ [Test, Performance]
124
+ public void TestCollectObservationsAgent()
125
+ {
126
+ Measure.Method(() =>
127
+ {
128
+ RunAgent<CollectObservationsAgent>(k_NumAgentSteps, 7, ObservableAttributeOptions.Ignore);
129
+ })
130
+ .MeasurementCount(k_MeasurementCount)
131
+ .GC()
132
+ .Run();
133
+ }
134
+
135
+ [Test, Performance]
136
+ public void TestObservableFieldAgent()
137
+ {
138
+ Measure.Method(() =>
139
+ {
140
+ RunAgent<ObservableFieldAgent>(k_NumAgentSteps, 0, ObservableAttributeOptions.ExcludeInherited);
141
+ })
142
+ .MeasurementCount(k_MeasurementCount)
143
+ .GC()
144
+ .Run();
145
+ }
146
+
147
+ [Test, Performance]
148
+ public void TestObservablePropertyAgent()
149
+ {
150
+ Measure.Method(() =>
151
+ {
152
+ RunAgent<ObservablePropertyAgent>(k_NumAgentSteps, 0, ObservableAttributeOptions.ExcludeInherited);
153
+ })
154
+ .MeasurementCount(k_MeasurementCount)
155
+ .GC()
156
+ .Run();
157
+ }
158
+
159
+ [Test, Performance]
160
+ public void TestCollectObservationsAgentMarkers()
161
+ {
162
+ using (Measure.ProfilerMarkers(s_Markers))
163
+ {
164
+ for (var i = 0; i < k_MarkerTestSteps; i++)
165
+ {
166
+ RunAgent<CollectObservationsAgent>(k_NumAgentSteps, 7, ObservableAttributeOptions.Ignore);
167
+ }
168
+ }
169
+ }
170
+
171
+ [Test, Performance]
172
+ public void TestObservableFieldAgentMarkers()
173
+ {
174
+ using (Measure.ProfilerMarkers(s_Markers))
175
+ {
176
+ for (var i = 0; i < k_MarkerTestSteps; i++)
177
+ {
178
+ RunAgent<ObservableFieldAgent>(k_NumAgentSteps, 0, ObservableAttributeOptions.ExcludeInherited);
179
+ }
180
+ }
181
+ }
182
+
183
+ [Test, Performance]
184
+ public void TestObservablePropertyAgentMarkers()
185
+ {
186
+ using (Measure.ProfilerMarkers(s_Markers))
187
+ {
188
+ for (var i = 0; i < k_MarkerTestSteps; i++)
189
+ {
190
+ RunAgent<ObservableFieldAgent>(k_NumAgentSteps, 0, ObservableAttributeOptions.ExcludeInherited);
191
+ }
192
+ }
193
+ }
194
+ }
195
+ }