Skip to main content

libero2gym

A simple Gym wrapper for the LIBERO benchmark.

Key Features

  • Standard Gym Interface: Simplifies environment setup by eliminating the complex configuration steps required by the original LIBERO library.
  • Asynchronous Parallelization: Supports efficient, large-scale rollouts and evaluations using an asynchronous vectorized environment.
  • Enhanced Observations: Provides properly oriented RGB, Depth, and Point Cloud observations out-of-the-box. Images are correctly flipped and ready to use.
  • Ready-to-Use States: Offers concatenated proprioceptive states (e.g., for models like OpenVLA and PI-0), removing the need for manual data processing and concatenation.

Installation

First, clone the repository and install the package in editable mode:

git clone https://github.com/ZibinDong/libero2gym
cd libero2gym
pip install -e .

If you require point cloud observations, you must install additional dependencies for preprocessing:

pip install -e .[pc]

Usage

Single Environment

import gym
import libero2gym

# Create the first task from the LIBERO-Goal suite
env = gym.make("libero-goal-v0", task_id=0) 

# Reset the environment to the first of LIBERO's 50 predefined initial states.
# If `init_state_id` is not specified, a random from the predefined states will be chosen.
obs = env.reset(options={"init_state_id": 0})  

# Sample a random action
act = env.action_space.sample()  
next_obs, reward, done, info = env.step(act)

Multiple Environments (Vectorized)

from functools import partial
import gym
import libero2gym
from libero2gym.vector_env import AsyncVectorEnv

# Define environment configuration
env_kwargs = {"task_id": 0}

# Create partial functions for the real and dummy environments
env_fn = partial(gym.make, id="libero-goal-v0", **env_kwargs)
dummy_env_fn = partial(gym.make, id="libero-goal-v0", dummy=True, **env_kwargs)

# Initialize 8 parallel environments
envs = AsyncVectorEnv(
    env_fns=[env_fn for _ in range(8)],
    dummy_env_fn=dummy_env_fn,
)

# Reset all 8 environments, each with a different initial state
obs = envs.reset(options=[{"init_state_id": i} for i in range(8)])

# Sample a single action to be applied to all environments
act = env.action_space.sample() 
next_obs, reward, done, info = envs.step(act)

Environment Kwargs

You can customize the environment by passing keyword arguments to gym.make():

env_kwargs = {
    # Specify the task ID (from the task suite)
    "task_id": 0,    
    # Image resolution; returns a uint8 array of shape (H, W, 3) for RGB
    "image_size": 224,
    # If True, returns a float32 depth array of shape (H, W)
    "require_depth": False,
    # Maximum depth value; values beyond this are clipped
    "depth_clip": 2.0,
    # If True, returns a float32 point cloud array of shape (N, 3)
    "require_point_cloud": False,
    # Number of points (N) in the point cloud
    "num_points": 8192,
    # If True, returns detailed robot and object states. 
    # The default concatenated state of shape (9,) is usually sufficient.
    "require_detailed_states": False,
    # List of camera names to use; defaults to a dual-camera setup
    "camera_names": ["agentview", "robot0_eye_in_hand"],
    # Max steps per episode. Defaults to 600 for LIBERO-10 and 300 for others.
    "max_episode_steps": 300,
    # Random seed for the environment
    "seed": 0,
    # Device for point cloud preprocessing ("cpu" or "cuda:x")
    "pointcloud_process_device": "cpu",
}

env = gym.make("libero-goal-v0", **env_kwargs)

Metadata

Release files for libero2gym 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libero2gym 0.1.0
File Size Uploaded Provenance Actions
libero2gym-0.1.0.tar.gz 13.3 kB Without provenance Details for libero2gym-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for libero2gym 0.1.0
File Interpreter ABI Platform Actions
libero2gym-0.1.0-py3-none-any.whl Python 3 none any Details for libero2gym-0.1.0-py3-none-any.whl

Total release size: 25.4 kB

Release files / libero2gym-0.1.0.tar.gz

Download URL libero2gym-0.1.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6887f11eef881480f2df13595a98fe3217752c17ba56d31a1f17dcc1ab83e96d
BLAKE2b-256 checksum
How to use checksums
96a2cb22c5ffef3043242c51beea26b3dc2d73dfa416d0a6a0ac26fc265c9e94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / libero2gym-0.1.0-py3-none-any.whl

Download URL libero2gym-0.1.0-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b561f46f2c3b0849d1e2a37e3a67a2825dc7fb4f53aefde641d3d6c43cfe2c0e
BLAKE2b-256 checksum
How to use checksums
15f019f279064d7d4d09c9f89529938196980cbec16819d71b6496f95687f69e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for libero2gym 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page