LiberoEnv#
- torchrl.envs.LiberoEnv(*args, num_workers: int | None = None, num_envs: int | None = None, **kwargs)[source]#
LIBERO environment built from a task-suite name and task id.
GitHub: Lifelong-Robot-Learning/LIBERO
Paper: https://arxiv.org/abs/2306.03310 (LIBERO: Benchmarking Knowledge Transfer for Lifelong Robot Learning, Liu et al., 2023)
See
LiberoWrapperfor the full TensorDict schema and keyword arguments. This constructor builds the underlyingOffScreenRenderEnvfrom the benchmark registry, fetches the task’s language instruction and its fixed initial states (50 per task in the standard suites) and wires them into the init-state control machinery.- Parameters:
task_suite (str) – the task-suite name, from
available_envs(e.g."libero_spatial","libero_object","libero_goal","libero_10").task_id (int) – the task index inside the suite.
- Keyword Arguments:
num_workers (int, optional) – if greater than
1, return aParallelEnvwithnum_workersLIBERO workers. Defaults to1.num_envs (int, optional) – alias for
num_workers.camera_height (int or list of int, optional) – rendered image height. When
num_workers > 1, a list dispatches one value per worker and must have lengthnum_workers. Defaults to256(the SimpleVLA-RL / OpenVLA-OFT resolution).camera_width (int or list of int, optional) – rendered image width. When
num_workers > 1, a list dispatches one value per worker and must have lengthnum_workers. Defaults to256.render_gpu_device_id (int or list of int, optional) – GPU device id used by robosuite for offscreen rendering. This is the EGL-visible device id inside the process/container, not necessarily the global CUDA ordinal. Use this to spread LIBERO render workers across multiple GPUs, e.g.
worker_idx % num_render_gpus. If omitted, robosuite selects its default device. Whennum_workers > 1, a list dispatches one value per worker and must have lengthnum_workers. Defaults toNone.env_kwargs (dict or list of dict, optional) – extra keyword arguments forwarded to
OffScreenRenderEnv(e.g.horizon). Whennum_workers > 1, a list dispatches one dict per worker and must have lengthnum_workers.**kwargs – see
LiberoWrapper. Whennum_workers > 1, list-valued keyword arguments are dispatched across workers and must have lengthnum_workers; use tuples for sequence-valued arguments that should be broadcast to every worker (for exampleproprio_keys).
Examples
>>> from torchrl.envs import LiberoEnv >>> env = LiberoEnv( ... "libero_spatial", ... task_id=0, ... camera_height=128, ... camera_width=128, ... init_state_mode="cycle", ... ) >>> td = env.reset() >>> td["language_instruction"] 'pick up the black bowl between the plate and the ramekin and place it on the plate' >>> td["observation", "image"].shape torch.Size([3, 128, 128])