Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates deps and wrappers for version 0.4.8 #94

Merged
merged 2 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: |
python -m pip install --upgrade pip
# cpu version of pytorch
pip install .[test,sb3]
pip install .[test]
- name: Download examples
run: |
make download_examples
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This quickstart guide will get you up and running using the Godot RL Agents libr
1. Install the Godot RL Agents library: (if you are new to python, pip and conda, read this [guide](https://www.machinelearningplus.com/deployment/conda-create-environment-and-everything-you-need-to-know-to-manage-conda-virtual-environment/))

```bash
pip install godot-rl[sb3]
pip install godot-rl
```

1. Download one, or more of [examples](https://github.com/edbeeching/godot_rl_agents_examples), such as BallChase, JumperHard, FlyBy.
Expand Down
1 change: 1 addition & 0 deletions godot_rl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def get_args():
parser.add_argument("--num_gpus", default=None, type=int, help="Number of GPUs to use [only for rllib]")
parser.add_argument("--experiment_name", default=None, type=str, help="The name of the experiment [only for rllib]")
parser.add_argument("--viz", default=False, action="store_true", help="Whether to visualize one process")

return parser.parse_known_args()


Expand Down
4 changes: 2 additions & 2 deletions godot_rl/wrappers/stable_baselines_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def step_wait(self):
raise NotImplementedError()


def stable_baselines_training(args, extras):
def stable_baselines_training(args, extras, n_steps=200000):
# TODO: Add cla etc for sb3
env = StableBaselinesGodotEnv(env_path=args.env_path, show_window=args.viz, speedup=args.speedup)

Expand All @@ -81,7 +81,7 @@ def stable_baselines_training(args, extras):
n_steps=32,
tensorboard_log="logs/log",
)
model.learn(1000000)
model.learn(n_steps)

print("closing env")
env.close()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "godot_rl"
version = "0.4.7"
version = "0.4.8"
authors = [
{ name="Edward Beeching", email="edbeeching@gmail.com" },
]
Expand Down
17 changes: 15 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ install_requires =
tensorboard
wget
huggingface_hub>=0.10

gym==0.26.2
stable-baselines3
huggingface_sb3

python_requires = >=3.8
zip_safe = no
Expand All @@ -41,7 +43,7 @@ dev =
pyyaml>=5.3.1

sb3 =
gym==0.21
gym==0.26.2
stable-baselines3
huggingface_sb3

Expand All @@ -57,3 +59,14 @@ rllib =

clean-rl =
wandb

all =
numpy==1.23.5
gym==0.26.2
stable-baselines3
huggingface_sb3
sample-factory

ray==2.2.0
ray[rllib]
tensorflow_probability
19 changes: 19 additions & 0 deletions tests/test_sb3_training.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest

from godot_rl.core.godot_env import GodotEnv
from godot_rl.main import get_args

try:
from godot_rl.wrappers.stable_baselines_wrapper import stable_baselines_training
except ImportError as e:

def stable_baselines_training(args, extras):
print("Import error when trying to use sb3, this is probably not installed try pip install godot-rl[sb3]")


def test_sb3_training():
args, extras = get_args()
args.env = "gdrl"
args.env_path = "examples/godot_rl_JumperHard/bin/JumperHard.x86_64"

stable_baselines_training(args, extras, n_steps=10000)