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

Brax fixes #311

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
33 changes: 5 additions & 28 deletions notebooks/brax_training.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"outputs": [],
"source": [
"!pip install git+https://github.com/Denys88/rl_games"
"!pip install git+https://github.com/Denys88/rl_games ray"
]
},
{
Expand All @@ -33,15 +33,9 @@
"#@markdown ## ⚠️ PLEASE NOTE:\n",
"#@markdown This colab runs using a GPU runtime. From the Colab menu, choose Runtime > Change Runtime Type, then select **'GPU'** in the dropdown.\n",
"\n",
"from datetime import datetime\n",
"import functools\n",
"import os\n",
"\n",
"from IPython.display import HTML, clear_output\n",
"from IPython.display import display, clear_output\n",
"\n",
"import jax\n",
"import jax.numpy as jnp\n",
"import matplotlib.pyplot as plt\n",
"\n",
"try:\n",
" import brax\n",
Expand All @@ -50,10 +44,10 @@
" clear_output()\n",
" import brax\n",
"\n",
"from brax import envs\n",
"from brax import jumpy as jp\n",
"from brax.io import html\n",
"from brax.io import model"
"\n",
"from rl_games.torch_runner import Runner\n",
"from rl_games.envs.brax import BraxEnv"
]
},
{
Expand Down Expand Up @@ -213,9 +207,6 @@
},
"outputs": [],
"source": [
"import yaml\n",
"from rl_games.torch_runner import Runner\n",
"\n",
"env_name = 'ant' # @param ['ant', 'humanoid']\n",
"configs = {\n",
" 'ant' : ant_config,\n",
Expand All @@ -238,20 +229,6 @@
"})"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "3s-95B-KlqE1"
},
"outputs": [],
"source": [
"from rl_games.envs.brax import BraxEnv\n",
"\n",
"from IPython.display import HTML, IFrame, display, clear_output\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ psutil = "^5.9.0"
setproctitle = "^1.2.2"
opencv-python = "^4.5.5"
wandb = "^0.12.11"
gymnasium = "^1.0"

ale-py = {version = "^0.7", optional = true}
AutoROM = {version = "^0.4.2", optional = true, extras = ["accept-rom-license"]}
brax = {version = "^0.0.13", optional = true}
jax = {version = "^0.3.13", optional = true}
mujoco-py = {version = "^2.1.2", optional = true}
envpool = {version = "^0.6.1", optional = true}
ray = {version = "^2.2.0", optional = true}

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
3 changes: 1 addition & 2 deletions rl_games/envs/brax.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ def torch_to_jax(tensor):

class BraxEnv(IVecEnv):
def __init__(self, config_name, num_actors, **kwargs):
from brax import envs
import jax.numpy as jnp
from brax.v1 import envs

self.batch_size = num_actors
env_name=kwargs.pop('env_name', 'ant')
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# this setup is only for pytorch
#
'gym>=0.17.2',
'gymnasium'
'torch>=1.7.0',
'numpy>=1.16.0',
'tensorboard>=1.14.0',
Expand Down