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

Add gymnasium/gym import #123

Closed
wants to merge 0 commits into from
Closed

Add gymnasium/gym import #123

wants to merge 0 commits into from

Conversation

Vittorio-Caggiano
Copy link
Collaborator

@Vittorio-Caggiano Vittorio-Caggiano commented Dec 13, 2023

This PR adds:

  1. Gym/Gymnasiums capabilities -- this will allow users to use ether libraries
  2. Add torchRL tutorial scripts

@@ -3,7 +3,9 @@
Authors :: Vikash Kumar ([email protected]), Vittorio Caggiano ([email protected])
================================================= """

from gym.envs.registration import register
# from myosuite.utils.import_utils import import_gym; gym = import_gym(); register=gym.register
Copy link
Collaborator

Choose a reason for hiding this comment

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

Clean up

@@ -200,17 +200,6 @@ def __init__(self,
self.relief_range = relief_range
self._populate_patches()

def flatten_agent_patch(self, qpos):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like throughout this file, we are overwriting newer commits. Be careful here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@P-Schumacher can we have your feedback on this ?

Copy link
Collaborator

@vikashplus vikashplus left a comment

Choose a reason for hiding this comment

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

Just mark "Done" against the comments. Im hopping on a flight. Can take another pass later tonight if I manage to land today :P

@@ -22,7 +23,9 @@ declare -a StringArray=(
"2_Load_policy.ipynb" \
"3_Analyse_movements.ipynb" \
# "4_Train_policy.ipynb" \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Some of the tutorials are commented out. Let's make sure they pass CIs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vikashplus the mjrl is broken. Can you please check what is not working?
@P-Schumacher the Deprl tutorial is broken. Can you please check it?

Copy link
Collaborator Author

@Vittorio-Caggiano Vittorio-Caggiano left a comment

Choose a reason for hiding this comment

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

removed commented legacy solution

class gym(): pass

# https://stackoverflow.com/questions/21434332/how-to-extend-inheritance-a-module-in-python
for i in gg.__all__ + ['__version__', 'envs', 'utils', 'spaces']:
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Vittorio-Caggiano -- I'm curious why you are explicitly adding ['envs', 'utils', 'spaces']. Aren't they present by default? Maybe I'm missing something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

__all__ gets only the variables but the modules are not provided. Those modules are the ones specifically needed for myosuite.
Actually, a more comprehensive solution could be to add all modules with something like:
[m[0] for m in inspect.getmembers(gg, predicate=inspect.ismodule)]

Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe I have found a much cleaner answer. Giving it a try now. Will update in sometime

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it working. See this commit - vikashplus/robohive@1052b24

@@ -287,14 +287,15 @@ def register_env_with_variants(id, entry_point, max_episode_steps, kwargs):
# Gait Torso Reaching ==============================
from myosuite.physics.sim_scene import SimBackend
sim_backend = SimBackend.get_sim_backend()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

is this still needed? (it doesn't seem to be used)

Base automatically changed from dev to main January 11, 2024 01:06
@Vittorio-Caggiano Vittorio-Caggiano changed the base branch from main to dev January 18, 2024 13:23
@vikashplus vikashplus closed this Jan 20, 2024
@Vittorio-Caggiano Vittorio-Caggiano deleted the add_gymnasium branch April 9, 2024 15:36
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.

3 participants