From e79909667035262ae7081e5f8da7b02bd2397eca Mon Sep 17 00:00:00 2001 From: Felix Jung Date: Thu, 13 Jul 2023 09:34:18 +0200 Subject: [PATCH 1/2] switched to mlagents fork to customize packages --- .gitmodules | 3 ++- ml-agents | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9ddb36f..891e1d5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,4 +2,5 @@ path = doxygen-awesome-css url = https://github.com/jothepro/doxygen-awesome-css.git [submodule "ml-agents"] - url = https://github.com/Unity-Technologies/ml-agents + path = ml-agents + url = https://github.com/Pristar4/ml-agents diff --git a/ml-agents b/ml-agents index 89a6357..3fd3fdf 160000 --- a/ml-agents +++ b/ml-agents @@ -1 +1 @@ -Subproject commit 89a6357016f4bd685bb0004f83a3a1c2b27a0e05 +Subproject commit 3fd3fdf1570b58109f5ad883b364b3526bc68ad7 From 65c0ff8ba08ba05ae44983e1df807b52b4863acb Mon Sep 17 00:00:00 2001 From: Felix Jung Date: Thu, 13 Jul 2023 10:27:07 +0200 Subject: [PATCH 2/2] Update mlagents installation --- Assets/ML-Agents/Timers/AI_timers.json | 77 +------------------------- Packages/packages-lock.json | 2 +- README.md | 35 ++++++++---- 3 files changed, 27 insertions(+), 87 deletions(-) diff --git a/Assets/ML-Agents/Timers/AI_timers.json b/Assets/ML-Agents/Timers/AI_timers.json index 6341717..ef4777d 100644 --- a/Assets/ML-Agents/Timers/AI_timers.json +++ b/Assets/ML-Agents/Timers/AI_timers.json @@ -1,76 +1 @@ -{ - "count": 1, - "self": 10.819744799999999, - "total": 11.2268753, - "children": { - "InitializeActuators": { - "count": 8, - "self": 0.0015133, - "total": 0.0015133, - "children": null - }, - "InitializeSensors": { - "count": 8, - "self": 0.0015168, - "total": 0.0015168, - "children": null - }, - "AgentSendState": { - "count": 60, - "self": 0.0010157, - "total": 0.2497354, - "children": { - "CollectObservations": { - "count": 480, - "self": 0.2456526, - "total": 0.2456526, - "children": null - }, - "WriteActionMask": { - "count": 480, - "self": 0.0010668, - "total": 0.0010668, - "children": null - }, - "RequestDecision": { - "count": 480, - "self": 0.0020003, - "total": 0.0020003, - "children": null - } - } - }, - "DecideAction": { - "count": 60, - "self": 0.0015038, - "total": 0.0015038, - "children": null - }, - "AgentAct": { - "count": 60, - "self": 0.1528612, - "total": 0.1528612, - "children": null - } - }, - "gauges": { - "SnakeAi.CumulativeReward": { - "count": 71, - "max": 19.3010044, - "min": -11.4027328, - "runningAverage": -9.782438, - "value": -11.1, - "weightedAverage": -11.1100969 - } - }, - "metadata": { - "timer_format_version": "0.1.0", - "start_time_seconds": "1689188193", - "unity_version": "2023.1.3f1", - "command_line_arguments": "C:\\Program Files\\Unity\\Hub\\Editor\\2023.1.3f1\\Editor\\Unity.exe -projectpath C:\\Users\\felix\\SnakeGame -useHub -hubIPC -cloudEnvironment production", - "communication_protocol_version": "1.5.0", - "com.unity.ml-agents_version": "2.3.0-exp.3", - "scene_name": "AI", - "end_time_seconds": "1689188204" - } -} +{"count":1,"self":52.1213024,"total":203.22109279999998,"children":{"InitializeActuators":{"count":8,"self":0.0015027999999999999,"total":0.0015027999999999999,"children":null},"InitializeSensors":{"count":8,"self":0.0009995,"total":0.0009995,"children":null},"AgentSendState":{"count":11931,"self":0.3958809,"total":46.6378529,"children":{"CollectObservations":{"count":95448,"self":45.2260704,"total":45.2260693,"children":null},"WriteActionMask":{"count":95448,"self":0.069559,"total":0.069559,"children":null},"RequestDecision":{"count":95448,"self":0.24414899999999998,"total":0.9463437,"children":{"AgentInfo.ToProto":{"count":95448,"self":0.2084828,"total":0.7021947,"children":{"GenerateSensorData":{"count":95448,"self":0.4937119,"total":0.4937119,"children":null}}}}}}},"DecideAction":{"count":11931,"self":86.9446208,"total":86.9446225,"children":null},"AgentAct":{"count":11931,"self":17.4810832,"total":17.5128017,"children":{"AgentInfo.ToProto":{"count":3755,"self":0.0141082,"total":0.0317178,"children":{"GenerateSensorData":{"count":3755,"self":0.0176096,"total":0.0176096,"children":null}}}}}},"gauges":{"SnakeAi.CumulativeReward":{"count":3755,"max":30.8355713,"min":-11.4027338,"runningAverage":-8.165549,"value":21.9621029,"weightedAverage":7.757939}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1689234894","unity_version":"2023.1.3f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.1.3f1\\Editor\\Unity.exe -projectpath C:\\Users\\felix\\SnakeGame -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.4","scene_name":"AI","end_time_seconds":"1689235097"}} \ No newline at end of file diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index e093ca6..54577a9 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -226,7 +226,7 @@ "depth": 0, "source": "local", "dependencies": { - "com.unity.ml-agents": "2.3.0-exp.3", + "com.unity.ml-agents": "2.3.0-exp.4", "com.unity.modules.physics": "1.0.0" } }, diff --git a/README.md b/README.md index 1b3438d..78030c2 100644 --- a/README.md +++ b/README.md @@ -130,19 +130,34 @@ Perform the following steps to set up and run the project: ``` 4. Install ML-agents within the virtual environment by following the Getting Started in the ml-agents rep - ``` - pip install mlagents - ``` -5. Start the training by running: - ``` - mlagents-learn config/ppo/Snake.yaml --run-id=trainingRun01 +5. ``` + python.exe -m pip install --upgrade pip + ``` +6. ``` + pip install torch -f https://download.pytorch.org/whl/torch_stable.html + ``` +7. ``` + pip install tensorboard ``` -6. Open a second terminal and start TensorBoard to monitor training. +7. ``` + pip install -e ./ml-agents-envs ``` - tensorboard --logdir results +8. ``` + pip install -e ./ml-agents ``` -7. Enter the Play mode in the Unity editor in the AI scene - under ``SnakeGame\Assets\SnakeGame\_Levels\AI``. +9. ``` + pip install tensorboard + ``` +9. Start the training by running: + ``` + mlagents-learn config/ppo/Snake.yaml --run-id=trainingRun01 + ``` +10. Open a second terminal and start TensorBoard to monitor training. + ``` + tensorboard --logdir results + ``` +11. Enter the Play mode in the Unity editor in the AI scene + under ``SnakeGame\Assets\SnakeGame\_Levels\AI``.

(back to top)