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

Tutorial for how to use the jacobian of mjx.step #1601

Merged
merged 25 commits into from
Apr 24, 2024

Conversation

Andrew-Luo1
Copy link
Contributor

A notebook showing how to use vanilla policy gradients to accelerate policy learning, thanks to MJX's differentiability. Demonstrations are given for imitation learning and locomotion, for a quadruped. Requires Brax PR 476.

Supporting changes

  1. Add an Anymal C model, cleaned for faster simulation on MJX similarly to MJX Barkour
  2. Add an image for the notebook

@Andrew-Luo1
Copy link
Contributor Author

Just as a heads up:

  1. Right now I hard-code the xml path, rather than use epath like in the other MJX tutorial - I could not get epath working locally.
  2. For the PPO benchmarks, I ran into issues with nan rewards which dissapeared when I turned on the debug nans flag.

@erikfrey erikfrey self-assigned this Apr 17, 2024
erikfrey pushed a commit to google/brax that referenced this pull request Apr 18, 2024
Updates APG to learn useful policies, see: google-deepmind/mujoco#1601
@erikfrey
Copy link
Collaborator

Exciting! How many changes did you make to anymal? Can you try this:

  • Make a PR to mujoco menagerie with anymal_c_mjx.xml and scene_mjx.xml with your anymal modifications
  • Somewhere at the top of your colab, do:
!git clone https://github.com/google-deepmind/mujoco_menagerie.git

Then you should be able to remove the anymal assets from this PR. Let me know if that works!

@Andrew-Luo1
Copy link
Contributor Author

Hi Erik, I've proposed Menagerie PR 50 with the Anymal C updates, and have documented the modifications in the readme. I've updated this notebook as well.

The formatting of this notebook isn't quite the same as the current mujoco notebooks. In the case that this PR goes through, of course feel free to modify it as you see fit: adding the Mujoco banner, adding a colab instance, etc!

And let me know if there's anything I can do to bring the notebook more up to standards.

Copy link
Collaborator

@erikfrey erikfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I see your change is incorporated into menagerie. Looking great! One last nit and we will merge.

@@ -44,4 +44,4 @@ mjx-viewer = "mujoco.mjx.viewer:main"
Homepage = "https://github.com/google-deepmind/mujoco/tree/main/mjx"
Documentation = "https://mujoco.readthedocs.io/en/3.1.5"
Repository = "https://github.com/google-deepmind/mujoco/tree/main/mjx"
Changelog = "https://mujoco.readthedocs.io/en/3.1.5/changelog.html"
Changelog = "https://mujoco.readthedocs.io/en/3.1.5/changelog.html"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this is an unneeded change - can you revert? Otherwise, let me know what this is for.

Copy link
Collaborator

@erikfrey erikfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful, thank you!

@copybara-service copybara-service bot merged commit 68e33f4 into google-deepmind:main Apr 24, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants