Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
reginald-mclean committed Aug 29, 2024
1 parent cfecdaf commit 16480c0
Show file tree
Hide file tree
Showing 57 changed files with 155 additions and 196 deletions.
28 changes: 14 additions & 14 deletions docs/introduction/basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ firstpage:
There are 6 major benchmarks pre-packaged into Meta-World with support for making your own custom benchmarks. The benchmarks are divided into Multi-Task and Meta reinforcement learning benchmarks.

### Multi-Task Benchmarks
The MT1, MT10, and MT50 benchmarks are the Multi-Task Benchmarks. These benchmarks are used to learn a multi-task policy that can learn 1, 10, or 50 training tasks simultaneously. MT1 benchmarks can be created with any of the 50 tasks available in Meta-World.
In the MT10 and MT50 benchmarks, the observations returned by the benchmark will come with one-hot task IDs appended to the state.
The MT1, MT10, and MT50 benchmarks are the Multi-Task Benchmarks. These benchmarks are used to learn a multi-task policy that can learn 1, 10, or 50 training tasks simultaneously. MT1 benchmarks can be created with any of the 50 tasks available in Meta-World.
In the MT10 and MT50 benchmarks, the observations returned by the benchmark will come with one-hot task IDs appended to the state.

### Meta-Learning Benchmarks
The ML1, ML10, and ML45 benchmarks are 3 meta-reinforcement learning benchmarks available in Meta-World. The ML1 benchmark can be used with any of the 50 tasks available in Meta-World.
The ML1 benchmark tests for few-shot adaptation to goal variations within a single task. The ML10 and ML45 both test few-shot adaptation to new tasks. ML10 comprises 10 train tasks with 5 test tasks, while ML45 comprises of 45 training tasks with 5 test tasks.
The ML1 benchmark tests for few-shot adaptation to goal variations within a single task. The ML10 and ML45 both test few-shot adaptation to new tasks. ML10 comprises 10 train tasks with 5 test tasks, while ML45 comprises of 45 training tasks with 5 test tasks.


## Creating Multi-Task Benchmarks

### MT1
```python
import gymnasium as gym
import metaworld
import metaworld

seed = 42 # for reproducibility

Expand All @@ -36,8 +36,8 @@ obs, reward, truncate, terminate, info = env.step(a) # apply the randomly sample
```

### MT10
MT10 has two different versions that can be returned by gym.make. The first version is the synchronous version of the benchmark where all environments are contained within the same process.
For users with limited compute resources, the synchronous option needs the least resources.
MT10 has two different versions that can be returned by gym.make. The first version is the synchronous version of the benchmark where all environments are contained within the same process.
For users with limited compute resources, the synchronous option needs the least resources.
```python
import gymnasium as gym
import metaworld
Expand All @@ -59,7 +59,7 @@ envs = gym.make('Meta-World/MT10-async', seed=seed) # this returns an Asynchrono
```

### MT50
MT50 also contains two different versions, a synchronous and an asynchronous version, of the environments.
MT50 also contains two different versions, a synchronous and an asynchronous version, of the environments.
```python
import gymnasium as gym
import metaworld
Expand All @@ -68,7 +68,7 @@ seed = 42

envs = gym.make('Meta-World/MT50-sync', seed=seed) # this returns a Synchronous Vector Environment with 50 environments

obs, info = envs.reset() # reset all 50 environments
obs, info = envs.reset() # reset all 50 environments

a = env.action_space.sample() # sample an action for each environment

Expand All @@ -90,7 +90,7 @@ import metaworld

seed = 42

train_envs = gym.make('Meta-World/ML1-train-reach-V3', seed=seed)
train_envs = gym.make('Meta-World/ML1-train-reach-V3', seed=seed)
test_envs = gym.make('Meta-World/ML1-test-reach-V3', seed=seed)

# training procedure use train_envs
Expand All @@ -100,10 +100,10 @@ test_envs = gym.make('Meta-World/ML1-test-reach-V3', seed=seed)


### ML10
Similar to the Multi-Task benchmarks, the ML10 and ML45 environments can be run in synchronous or asynchronous modes.
Similar to the Multi-Task benchmarks, the ML10 and ML45 environments can be run in synchronous or asynchronous modes.


```python
```python
import gymnasium as gym
import metaworld

Expand All @@ -113,7 +113,7 @@ test_envs = gym.make('Meta-World/ML10-test-sync', seed=seed) # or ML10-test-asyn


### ML45
```python
```python
import gymnasium as gym
import metaworld

Expand All @@ -123,10 +123,10 @@ test_envs = gym.make('Meta-World/ML45-test-sync', seed=seed) # or ML45-test-asyn


## Custom Benchmarks
Finally, we also provide support for creating custom benchmarks by combining any number of Meta-World environments.
Finally, we also provide support for creating custom benchmarks by combining any number of Meta-World environments.

The prefix 'mt' will return environments that are goal observable for Multi-Task reinforcement learning, while the prefix 'ml' will return environments that are partially observable for Meta-reinforcement learning.
Like the included MT and ML benchmarks, these environments can also be run in synchronous or asyncronous mode.
Like the included MT and ML benchmarks, these environments can also be run in synchronous or asynchronous mode.
In order to create a custom benchmark, the user must provide a list of environment names with the suffix '-V3'.

```python
Expand Down
17 changes: 14 additions & 3 deletions metaworld/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
import numpy.typing as npt

import metaworld.env_dict as _env_dict
from metaworld.types import Task
from .sawyer_xyz_env import SawyerXYZEnv
from metaworld.env_dict import (
ALL_V2_ENVIRONMENTS_GOAL_HIDDEN,
ALL_V2_ENVIRONMENTS_GOAL_OBSERVABLE,
)
from metaworld.types import Task

from .sawyer_xyz_env import SawyerXYZEnv


class MetaWorldEnv(abc.ABC):
Expand Down Expand Up @@ -290,4 +291,14 @@ def __init__(self, seed=None):
)


__all__ = ["ML1", "MT1", "ML10", "MT10", "ML45", "MT50", "ALL_V2_ENVIRONMENTS_GOAL_HIDDEN", "ALL_V2_ENVIRONMENTS_GOAL_OBSERVABLE", "SawyerXYZEnv"]
__all__ = [
"ML1",
"MT1",
"ML10",
"MT10",
"ML45",
"MT50",
"ALL_V2_ENVIRONMENTS_GOAL_HIDDEN",
"ALL_V2_ENVIRONMENTS_GOAL_OBSERVABLE",
"SawyerXYZEnv",
]
2 changes: 1 addition & 1 deletion metaworld/env_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import numpy as np
from typing_extensions import TypeAlias

from metaworld.sawyer_xyz_env import SawyerXYZEnv
from metaworld import envs
from metaworld.sawyer_xyz_env import SawyerXYZEnv

# Utils

Expand Down
152 changes: 38 additions & 114 deletions metaworld/envs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,131 +1,55 @@
from metaworld.envs.sawyer_assembly_peg_v2 import (
SawyerNutAssemblyEnvV2,
)
from metaworld.envs.sawyer_basketball_v2 import (
SawyerBasketballEnvV2,
)
from metaworld.envs.sawyer_bin_picking_v2 import (
SawyerBinPickingEnvV2,
)
from metaworld.envs.sawyer_assembly_peg_v2 import SawyerNutAssemblyEnvV2
from metaworld.envs.sawyer_basketball_v2 import SawyerBasketballEnvV2
from metaworld.envs.sawyer_bin_picking_v2 import SawyerBinPickingEnvV2
from metaworld.envs.sawyer_box_close_v2 import SawyerBoxCloseEnvV2
from metaworld.envs.sawyer_button_press_topdown_v2 import (
SawyerButtonPressTopdownEnvV2,
)
from metaworld.envs.sawyer_button_press_topdown_v2 import SawyerButtonPressTopdownEnvV2
from metaworld.envs.sawyer_button_press_topdown_wall_v2 import (
SawyerButtonPressTopdownWallEnvV2,
)
from metaworld.envs.sawyer_button_press_v2 import (
SawyerButtonPressEnvV2,
)
from metaworld.envs.sawyer_button_press_wall_v2 import (
SawyerButtonPressWallEnvV2,
)
from metaworld.envs.sawyer_coffee_button_v2 import (
SawyerCoffeeButtonEnvV2,
)
from metaworld.envs.sawyer_coffee_pull_v2 import (
SawyerCoffeePullEnvV2,
)
from metaworld.envs.sawyer_coffee_push_v2 import (
SawyerCoffeePushEnvV2,
)
from metaworld.envs.sawyer_button_press_v2 import SawyerButtonPressEnvV2
from metaworld.envs.sawyer_button_press_wall_v2 import SawyerButtonPressWallEnvV2
from metaworld.envs.sawyer_coffee_button_v2 import SawyerCoffeeButtonEnvV2
from metaworld.envs.sawyer_coffee_pull_v2 import SawyerCoffeePullEnvV2
from metaworld.envs.sawyer_coffee_push_v2 import SawyerCoffeePushEnvV2
from metaworld.envs.sawyer_dial_turn_v2 import SawyerDialTurnEnvV2
from metaworld.envs.sawyer_disassemble_peg_v2 import (
SawyerNutDisassembleEnvV2,
)
from metaworld.envs.sawyer_door_close_v2 import (
SawyerDoorCloseEnvV2,
)
from metaworld.envs.sawyer_disassemble_peg_v2 import SawyerNutDisassembleEnvV2
from metaworld.envs.sawyer_door_close_v2 import SawyerDoorCloseEnvV2
from metaworld.envs.sawyer_door_lock_v2 import SawyerDoorLockEnvV2
from metaworld.envs.sawyer_door_unlock_v2 import (
SawyerDoorUnlockEnvV2,
)
from metaworld.envs.sawyer_door_unlock_v2 import SawyerDoorUnlockEnvV2
from metaworld.envs.sawyer_door_v2 import SawyerDoorEnvV2
from metaworld.envs.sawyer_drawer_close_v2 import (
SawyerDrawerCloseEnvV2,
)
from metaworld.envs.sawyer_drawer_open_v2 import (
SawyerDrawerOpenEnvV2,
)
from metaworld.envs.sawyer_faucet_close_v2 import (
SawyerFaucetCloseEnvV2,
)
from metaworld.envs.sawyer_faucet_open_v2 import (
SawyerFaucetOpenEnvV2,
)
from metaworld.envs.sawyer_drawer_close_v2 import SawyerDrawerCloseEnvV2
from metaworld.envs.sawyer_drawer_open_v2 import SawyerDrawerOpenEnvV2
from metaworld.envs.sawyer_faucet_close_v2 import SawyerFaucetCloseEnvV2
from metaworld.envs.sawyer_faucet_open_v2 import SawyerFaucetOpenEnvV2
from metaworld.envs.sawyer_hammer_v2 import SawyerHammerEnvV2
from metaworld.envs.sawyer_hand_insert_v2 import (
SawyerHandInsertEnvV2,
)
from metaworld.envs.sawyer_handle_press_side_v2 import (
SawyerHandlePressSideEnvV2,
)
from metaworld.envs.sawyer_handle_press_v2 import (
SawyerHandlePressEnvV2,
)
from metaworld.envs.sawyer_handle_pull_side_v2 import (
SawyerHandlePullSideEnvV2,
)
from metaworld.envs.sawyer_handle_pull_v2 import (
SawyerHandlePullEnvV2,
)
from metaworld.envs.sawyer_lever_pull_v2 import (
SawyerLeverPullEnvV2,
)
from metaworld.envs.sawyer_peg_insertion_side_v2 import (
SawyerPegInsertionSideEnvV2,
)
from metaworld.envs.sawyer_peg_unplug_side_v2 import (
SawyerPegUnplugSideEnvV2,
)
from metaworld.envs.sawyer_pick_out_of_hole_v2 import (
SawyerPickOutOfHoleEnvV2,
)
from metaworld.envs.sawyer_pick_place_v2 import (
SawyerPickPlaceEnvV2,
)
from metaworld.envs.sawyer_pick_place_wall_v2 import (
SawyerPickPlaceWallEnvV2,
)
from metaworld.envs.sawyer_plate_slide_back_side_v2 import (
SawyerPlateSlideBackSideEnvV2,
)
from metaworld.envs.sawyer_plate_slide_back_v2 import (
SawyerPlateSlideBackEnvV2,
)
from metaworld.envs.sawyer_plate_slide_side_v2 import (
SawyerPlateSlideSideEnvV2,
)
from metaworld.envs.sawyer_plate_slide_v2 import (
SawyerPlateSlideEnvV2,
)
from metaworld.envs.sawyer_hand_insert_v2 import SawyerHandInsertEnvV2
from metaworld.envs.sawyer_handle_press_side_v2 import SawyerHandlePressSideEnvV2
from metaworld.envs.sawyer_handle_press_v2 import SawyerHandlePressEnvV2
from metaworld.envs.sawyer_handle_pull_side_v2 import SawyerHandlePullSideEnvV2
from metaworld.envs.sawyer_handle_pull_v2 import SawyerHandlePullEnvV2
from metaworld.envs.sawyer_lever_pull_v2 import SawyerLeverPullEnvV2
from metaworld.envs.sawyer_peg_insertion_side_v2 import SawyerPegInsertionSideEnvV2
from metaworld.envs.sawyer_peg_unplug_side_v2 import SawyerPegUnplugSideEnvV2
from metaworld.envs.sawyer_pick_out_of_hole_v2 import SawyerPickOutOfHoleEnvV2
from metaworld.envs.sawyer_pick_place_v2 import SawyerPickPlaceEnvV2
from metaworld.envs.sawyer_pick_place_wall_v2 import SawyerPickPlaceWallEnvV2
from metaworld.envs.sawyer_plate_slide_back_side_v2 import SawyerPlateSlideBackSideEnvV2
from metaworld.envs.sawyer_plate_slide_back_v2 import SawyerPlateSlideBackEnvV2
from metaworld.envs.sawyer_plate_slide_side_v2 import SawyerPlateSlideSideEnvV2
from metaworld.envs.sawyer_plate_slide_v2 import SawyerPlateSlideEnvV2
from metaworld.envs.sawyer_push_back_v2 import SawyerPushBackEnvV2
from metaworld.envs.sawyer_push_v2 import SawyerPushEnvV2
from metaworld.envs.sawyer_push_wall_v2 import SawyerPushWallEnvV2
from metaworld.envs.sawyer_reach_v2 import SawyerReachEnvV2
from metaworld.envs.sawyer_reach_wall_v2 import (
SawyerReachWallEnvV2,
)
from metaworld.envs.sawyer_shelf_place_v2 import (
SawyerShelfPlaceEnvV2,
)
from metaworld.envs.sawyer_reach_wall_v2 import SawyerReachWallEnvV2
from metaworld.envs.sawyer_shelf_place_v2 import SawyerShelfPlaceEnvV2
from metaworld.envs.sawyer_soccer_v2 import SawyerSoccerEnvV2
from metaworld.envs.sawyer_stick_pull_v2 import (
SawyerStickPullEnvV2,
)
from metaworld.envs.sawyer_stick_push_v2 import (
SawyerStickPushEnvV2,
)
from metaworld.envs.sawyer_sweep_into_goal_v2 import (
SawyerSweepIntoGoalEnvV2,
)
from metaworld.envs.sawyer_stick_pull_v2 import SawyerStickPullEnvV2
from metaworld.envs.sawyer_stick_push_v2 import SawyerStickPushEnvV2
from metaworld.envs.sawyer_sweep_into_goal_v2 import SawyerSweepIntoGoalEnvV2
from metaworld.envs.sawyer_sweep_v2 import SawyerSweepEnvV2
from metaworld.envs.sawyer_window_close_v2 import (
SawyerWindowCloseEnvV2,
)
from metaworld.envs.sawyer_window_open_v2 import (
SawyerWindowOpenEnvV2,
)
from metaworld.envs.sawyer_window_close_v2 import SawyerWindowCloseEnvV2
from metaworld.envs.sawyer_window_open_v2 import SawyerWindowOpenEnvV2

__all__ = [
"SawyerNutAssemblyEnvV2",
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/sawyer_assembly_peg_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from metaworld.asset_path_utils import full_v2_path_for
from metaworld.sawyer_xyz_env import RenderMode, SawyerXYZEnv
from metaworld.utils.reward_utils import tolerance
from metaworld.types import InitConfigDict, ObservationDict
from metaworld.utils.reward_utils import tolerance


class SawyerNutAssemblyEnvV2(SawyerXYZEnv):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/sawyer_basketball_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from metaworld.asset_path_utils import full_v2_path_for
from metaworld.sawyer_xyz_env import RenderMode, SawyerXYZEnv
from metaworld.utils import reward_utils
from metaworld.types import InitConfigDict
from metaworld.utils import reward_utils


class SawyerBasketballEnvV2(SawyerXYZEnv):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/sawyer_bin_picking_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from metaworld.asset_path_utils import full_v2_path_for
from metaworld.sawyer_xyz_env import RenderMode, SawyerXYZEnv
from metaworld.utils import reward_utils
from metaworld.types import InitConfigDict
from metaworld.utils import reward_utils


class SawyerBinPickingEnvV2(SawyerXYZEnv):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/sawyer_box_close_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

from metaworld.asset_path_utils import full_v2_path_for
from metaworld.sawyer_xyz_env import RenderMode, SawyerXYZEnv
from metaworld.utils import reward_utils
from metaworld.types import InitConfigDict
from metaworld.utils import reward_utils


class SawyerBoxCloseEnvV2(SawyerXYZEnv):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/sawyer_button_press_topdown_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

from metaworld.asset_path_utils import full_v2_path_for
from metaworld.sawyer_xyz_env import RenderMode, SawyerXYZEnv
from metaworld.utils import reward_utils
from metaworld.types import InitConfigDict
from metaworld.utils import reward_utils


class SawyerButtonPressTopdownEnvV2(SawyerXYZEnv):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/sawyer_button_press_topdown_wall_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

from metaworld.asset_path_utils import full_v2_path_for
from metaworld.sawyer_xyz_env import RenderMode, SawyerXYZEnv
from metaworld.utils import reward_utils
from metaworld.types import InitConfigDict
from metaworld.utils import reward_utils


class SawyerButtonPressTopdownWallEnvV2(SawyerXYZEnv):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/sawyer_button_press_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from metaworld.asset_path_utils import full_v2_path_for
from metaworld.sawyer_xyz_env import RenderMode, SawyerXYZEnv
from metaworld.utils import reward_utils
from metaworld.types import InitConfigDict
from metaworld.utils import reward_utils


class SawyerButtonPressEnvV2(SawyerXYZEnv):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/sawyer_button_press_wall_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from metaworld.asset_path_utils import full_v2_path_for
from metaworld.sawyer_xyz_env import RenderMode, SawyerXYZEnv
from metaworld.utils import reward_utils
from metaworld.types import InitConfigDict
from metaworld.utils import reward_utils


class SawyerButtonPressWallEnvV2(SawyerXYZEnv):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/sawyer_coffee_button_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from metaworld.asset_path_utils import full_v2_path_for
from metaworld.sawyer_xyz_env import RenderMode, SawyerXYZEnv
from metaworld.utils import reward_utils
from metaworld.types import InitConfigDict
from metaworld.utils import reward_utils


class SawyerCoffeeButtonEnvV2(SawyerXYZEnv):
Expand Down
Loading

0 comments on commit 16480c0

Please sign in to comment.