From 0118bb9224bc2139d974417da70cd5afe75b3865 Mon Sep 17 00:00:00 2001 From: Ivan-267 <61947090+Ivan-267@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:02:27 +0200 Subject: [PATCH 1/4] Clarify Python/onnx inference usage Clarified instructions for Python inference --- docs/ADV_STABLE_BASELINES_3.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/ADV_STABLE_BASELINES_3.md b/docs/ADV_STABLE_BASELINES_3.md index c4a9621f..4a03947b 100644 --- a/docs/ADV_STABLE_BASELINES_3.md +++ b/docs/ADV_STABLE_BASELINES_3.md @@ -89,6 +89,9 @@ python stable_baselines3_example.py --timesteps=100_000 --onnx_export_path=model ``` Note: If you interrupt/halt training using `ctrl + c`, it should save/export models before closing training (but only if you have included the corresponding arguments mentioned above). Using checkpoints (see below) is a safer way to keep progress. +> [!NOTE] +> For Python inference, the `Control Mode` in the Sync node in Godot Editor should be set to `Training`. Set `Onnx Inference` if you want to use the .onnx file without using the Python server (onnx inference uses C# instead). + ### Resume training from a saved .zip model: This will load the previously saved model.zip, and resume training for another 100 000 steps, so the saved model will have been trained for 200 000 steps in total. @@ -111,10 +114,12 @@ python stable_baselines3_example.py --experiment_name=experiment1 --timesteps=2_ Checkpoints will be saved to `logs\sb3\experiment1_checkpoints` in the above case, the location is affected by `--experiment_dir` and `--experiment_name`. ### Run inference on a saved model for 100_000 steps: -You can run inference on a model that was previously saved using either `--save_model_path` or `--save_checkpoint_frequency`. +You can run Python inference on a model that was previously saved using either `--save_model_path` or `--save_checkpoint_frequency`. ```bash python stable_baselines3_example.py --timesteps=100_000 --resume_model_path=model.zip --inference ``` +> [!NOTE] +> For Python inference, the `Control Mode` in the Sync node in Godot Editor should be set to `Training`. Set `Onnx Inference` if you want to use the .onnx file without using the Python server (onnx inference uses C# instead). ### Use a linear learning rate schedule: By default, the learning rate will be constant throughout training. From c817e2cceba572799613dd034ba8ecbb8de4749f Mon Sep 17 00:00:00 2001 From: Ivan-267 <61947090+Ivan-267@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:03:42 +0200 Subject: [PATCH 2/4] Update ADV_STABLE_BASELINES_3.md --- docs/ADV_STABLE_BASELINES_3.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ADV_STABLE_BASELINES_3.md b/docs/ADV_STABLE_BASELINES_3.md index 4a03947b..096e3b7a 100644 --- a/docs/ADV_STABLE_BASELINES_3.md +++ b/docs/ADV_STABLE_BASELINES_3.md @@ -92,7 +92,6 @@ Note: If you interrupt/halt training using `ctrl + c`, it should save/export mod > [!NOTE] > For Python inference, the `Control Mode` in the Sync node in Godot Editor should be set to `Training`. Set `Onnx Inference` if you want to use the .onnx file without using the Python server (onnx inference uses C# instead). - ### Resume training from a saved .zip model: This will load the previously saved model.zip, and resume training for another 100 000 steps, so the saved model will have been trained for 200 000 steps in total. Note that the console log will display the `total_timesteps` for the last training session only, so it will show `100000` instead of `200000`. @@ -118,6 +117,7 @@ You can run Python inference on a model that was previously saved using either ` ```bash python stable_baselines3_example.py --timesteps=100_000 --resume_model_path=model.zip --inference ``` + > [!NOTE] > For Python inference, the `Control Mode` in the Sync node in Godot Editor should be set to `Training`. Set `Onnx Inference` if you want to use the .onnx file without using the Python server (onnx inference uses C# instead). From 05473447ec99846f161a9f06130ed750dcb8a409 Mon Sep 17 00:00:00 2001 From: Ivan-267 <61947090+Ivan-267@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:11:23 +0200 Subject: [PATCH 3/4] Update Training mode description in NODE_REFERENCE.md Clarified the description of the Training mode and added details about saving/exporting a model for inference. --- docs/NODE_REFERENCE.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/NODE_REFERENCE.md b/docs/NODE_REFERENCE.md index 54b6e47e..e1a4923c 100644 --- a/docs/NODE_REFERENCE.md +++ b/docs/NODE_REFERENCE.md @@ -72,14 +72,13 @@ This is the main node that controls training and inference (using the trained mo There are three modes: -- Training - will start training when you click `Play` in Godot editor (or use the exported application as `--env_path` - in training). +- Training - After you start the Python training script, will start training when you click `Play` in Godot editor (or you can use the exported application as `--env_path` for training). This mode is also used for Python based inference of a saved model. > [!NOTE] > For training to work, you need > to [install Godot-RL](https://github.com/edbeeching/godot_rl_agents#installation-and-first-training) and start the -> training server using `gdrl`, or, to have the ability to save the model after training is done, using -> the [sb3 example script](https://github.com/edbeeching/godot_rl_agents/blob/main/docs/ADV_STABLE_BASELINES_3.md#sb3-example-script-usage). +> training server using the [sb3 example script](https://github.com/edbeeching/godot_rl_agents/blob/main/docs/ADV_STABLE_BASELINES_3.md#sb3-example-script-usage) - +> check the link also for how to save/export a model for Python or ONNX inference. - Human - `ai_controller.heuristic` will be set to `"human"`. You can use this to test the environment by manually controlling the agent, e.g. as implemented in From db8d8ef27d3fb31e2f53bb514b1ba2ec3562d599 Mon Sep 17 00:00:00 2001 From: Ivan-267 <61947090+Ivan-267@users.noreply.github.com> Date: Fri, 10 Jul 2026 22:19:16 +0200 Subject: [PATCH 4/4] Update Python inference instructions in documentation Clarified instructions for Python inference in Godot Editor regarding the Control Mode and Onnx Inference. --- docs/ADV_STABLE_BASELINES_3.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ADV_STABLE_BASELINES_3.md b/docs/ADV_STABLE_BASELINES_3.md index 096e3b7a..f4c21d13 100644 --- a/docs/ADV_STABLE_BASELINES_3.md +++ b/docs/ADV_STABLE_BASELINES_3.md @@ -90,7 +90,7 @@ python stable_baselines3_example.py --timesteps=100_000 --onnx_export_path=model Note: If you interrupt/halt training using `ctrl + c`, it should save/export models before closing training (but only if you have included the corresponding arguments mentioned above). Using checkpoints (see below) is a safer way to keep progress. > [!NOTE] -> For Python inference, the `Control Mode` in the Sync node in Godot Editor should be set to `Training`. Set `Onnx Inference` if you want to use the .onnx file without using the Python server (onnx inference uses C# instead). +> For Python inference, the `Control Mode` in the Sync node in Godot Editor should be set to `Training`. Set `Onnx Inference` if you want to run inference in Godot without Python (this mode uses C# instead). ### Resume training from a saved .zip model: This will load the previously saved model.zip, and resume training for another 100 000 steps, so the saved model will have been trained for 200 000 steps in total. @@ -119,7 +119,7 @@ python stable_baselines3_example.py --timesteps=100_000 --resume_model_path=mode ``` > [!NOTE] -> For Python inference, the `Control Mode` in the Sync node in Godot Editor should be set to `Training`. Set `Onnx Inference` if you want to use the .onnx file without using the Python server (onnx inference uses C# instead). +> For Python inference, the `Control Mode` in the Sync node in Godot Editor should be set to `Training`. Set `Onnx Inference` if you want to run inference in Godot without Python (this mode uses C# instead). ### Use a linear learning rate schedule: By default, the learning rate will be constant throughout training.