Meta-World

repository·main·Indexed 23 days ago

https://github.com/farama-foundation/metaworld

An open-source benchmark for developing and evaluating multi-task and meta-reinforcement learning algorithms in continuous control robotic manipulation environments. It provides collections of robotics environments, including MT (Multi-Task) and ML (Meta-Learning) benchmarks, and follows the Gymnasium interface. Version 3.1.1 supports Python 3.10 through 3.13 on Linux and macOS.

Tokens
17.2K
Snippets
35
Records
76
Agent score
83%

What's inside metaworld

  1. Browse Meta-World task descriptions

    main

    Meta-World contains 50 tasks designed for robotic manipulation benchmarks. Each task involves a specific manipulation goal (e.g., pushing, picking, rotating) and typically includes randomization of object or goal positions to ensure robustness.

    Common task categories include:

    • Rotation tasks: Turn on faucet, Turn off faucet, Turn dial, Lock door, Unlock door.
    • Push/Pull tasks: Push, Pull, Push mug, Pull mug, Push with stick, Pull with stick, Push with wall.
    • Pick and Place tasks: Pick&place, Pick bin, Place onto shelf, Pick out of hole.
    • Assembly/Disassembly: Assemble nut, Disassemble nut, Insert peg side, Unplug peg.
    • Interaction with objects: Open door, Close door, Open drawer, Close drawer, Open window, Close window, Press button.
  2. How agents are evaluated in Metaworld

    main

    In Metaworld, agents are evaluated based on their success rate rather than the episodic reward achieved during training.

    Success is determined by a success flag provided in the environment's info dictionary under the key "success". A value of 1 indicates the task has been accomplished, and 0 indicates it has not. An episode is considered successful if the success flag is 1 at any point during the episode, not just at the final timestep.

  3. Understand Meta-RL benchmark settings

    main

    Meta-RL settings evaluate an agent's ability to adapt to or learn new tasks using a hold-out set of test tasks. Unlike Multi-Task settings, Task IDs are not provided as input, requiring the algorithm to identify tasks through experience.

    Available Meta-RL settings:

    • ML1: Few-shot adaptation to goal variation within a single task (e.g., reaching, pushing, or pick and place). Meta-training uses 50 random initial object/goal positions, and meta-testing uses 10 held-out positions. Goal positions are not provided in the observation.
    • ML10: Few-shot adaptation to new tasks. Policies are meta-trained on 10 tasks and tested on 5 held-out tasks. Object and goal positions are randomized.
    • ML45: The most difficult setting. Policies are meta-trained on 45 tasks and tested on 5 held-out tasks. Object and goal positions are randomized, and training tasks are selected for structural similarity to test tasks.
  4. Understand Meta-Learning (ML) Benchmarks

    main

    Meta-Learning benchmarks test an agent's ability to adapt to new tasks or goal variations with few samples.

    • ML1: Tests few-shot adaptation to goal variations within a single task.
    • ML10: Comprises 10 training tasks and 5 test tasks.
    • ML45: Comprises 45 training tasks and 5 test tasks.

    Unlike MT benchmarks, ML benchmarks provide training and testing environments separately.

  5. Understand Multi-Task (MT) Benchmarks

    main

    Multi-Task benchmarks are designed for learning policies that handle multiple tasks simultaneously.

    • MT1: Uses a single task from the 50 available Meta-World tasks.
    • MT10: Uses 10 training tasks.
    • MT50: Uses 50 training tasks.

    Note on Observations: In MT10 and MT50 benchmarks, observations include one-hot task IDs appended to the state to facilitate multi-task learning.

  6. Understand Multi-Task RL benchmark settings

    main

    Meta-World provides multi-task settings where an agent must learn a predefined set of skills simultaneously. In these settings, the policy is typically provided with a one-hot vector indicating the current task.

    Available Multi-Task settings:

    • MT1: The simplest setting. A single task (e.g., reach, push, or pick place) is learned. No generalization testing is involved.
    • MT10: Uses 10 specific tasks (reach, push, pick and place, open door, open drawer, close drawer, press button top-down, insert peg side, open window, and open box). Object and goal positions are fixed to focus on skill acquisition.
    • MT50: The most challenging multi-task setting. It uses all 50 Meta-World tasks. Like MT10, object and goal positions are fixed and the policy receives a one-hot task vector.
  7. Understand the Meta-World action space structure

    main

    In Meta-World, all tasks share a common action space structure to allow a single policy to solve multiple tasks. The action space for the Sawyer robot is a Box(-1.0, 1.0, (4,), float32).

    An action vector consists of 4 dimensions:

    1. dx: Displacement of the end-effector in the x direction.
    2. dy: Displacement of the end-effector in the y direction.
    3. dz: Displacement of the end-effector in the z direction.
    4. Gripper: Adjustment for closing or opening the gripper.

    For tasks that do not require gripper usage, you should mask or ignore the gripper dimension and set it to a constant value that keeps the fingers permanently closed.

  8. Understand the Meta-World state space structure

    main

    Meta-World tasks are designed with a consistent state space structure, allowing a single policy or model to be shared across different tasks. The observation space uses placeholders to handle variability (e.g., if a task only involves one object instead of two).

    Every observation is a 9D state vector (though the documentation table lists indices up to 17, implying a larger underlying vector where specific segments are used). The core components include the end-effector's 3D Cartesian position and object information (position and orientation).

  9. Compare reward function versions v1 and v2

    main

    Meta-World implements two distinct reward function versions:

    • Version 1 (reward_func_version='v1'): Uses the original reward function. This is a modified version of the pick-place-wall task adapted for all other tasks. Use this when replicating results from papers that report on env-name-v1 environments.
    • Version 2 (reward_func_version='v2'): Uses the updated reward functions. Use this when replicating results from papers that report on env-name-v2 environments.
  10. Quickstart with Meta-World environments

    main

    You can use Meta-World environments via the gymnasium interface. To create an environment, use gym.make with a benchmark identifier (like Meta-World/MT1) and specify the specific task using the env_name parameter.

    Standard Gymnasium API methods like reset(), action_space.sample(), and step() are used to interact with the environment.

    import gymnasium as gym
    import metaworld
    
    env = gym.make('Meta-World/MT1', env_name='reach-v3')
    
    obs = env.reset()
    a = env.action_space.sample()
    next_obs, reward, terminate, truncate, info = env.step(a)
  11. Prerequisites for building garage Docker images

    main

    Before building or running the garage Docker images, ensure your system meets the following requirements:

    For Headless Images

    • Docker CE: Version 19.03 or higher (tested on 19.03.12).
    • OS: Tested on Ubuntu 16.04.

    For NVIDIA Images

    In addition to the headless requirements, you must have:

    • NVIDIA Driver: Latest version (tested on nvidia-390).
    • nvidia-docker2: Installed and configured.
    • OS: Tested on Ubuntu 16.04.
  12. Select reward function versions in Meta-World

    main

    Meta-World provides two versions of reward functions for its tasks. You can select which version to use by passing the reward_func_version keyword argument to the gym.make(...) function.

    All task rewards are designed to have the same magnitude to ensure equivalent learning across multi-task settings. The choice of version typically depends on which benchmark version (e.g., env-name-v1 vs env-name-v2) you are trying to replicate from existing literature.