From 65c0ff8ba08ba05ae44983e1df807b52b4863acb Mon Sep 17 00:00:00 2001
From: Felix Jung <felix.j.jung@gmail.com>
Date: Thu, 13 Jul 2023 10:27:07 +0200
Subject: [PATCH] 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``.
 
 <p align="right">(<a href="#readme-top">back to top</a>)</p>