LeRobot documentation

Environments

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.6.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Environments

Simulation environments are configured through EnvConfig and built by make_env. Each subclass declares its gym_kwargs and how to construct the vectorised environments.

See Environments from the Hub for using published environments and Adding a New Benchmark for contributing one.

EnvConfig

class lerobot.envs.EnvConfig

< >

( task: str | None = Nonefps: int = 30features: dict[str, PolicyFeature] = <factory>features_map: dict[str, str] = <factory>max_parallel_tasks: int = 1disable_env_checker: bool = True )

create_envs

< >

( n_envs: intuse_async_envs: bool = False )

Create {suite: {task_id: VectorEnv}}.

Default: single-task env via gym.make(). Multi-task benchmarks override. AsyncVectorEnv is the default for n_envs > 1; auto-downgraded to Sync for n_envs=1.

get_env_processors

< >

( )

Return (preprocessor, postprocessor) for this env. Default: identity.

make_env

lerobot.envs.make_env

< >

( cfg: EnvConfig | strn_envs: int = 1use_async_envs: bool = Falsehub_cache_dir: str | None = Nonetrust_remote_code: bool = False ) dict[str, dict[int, gym.vector.VectorEnv]]

Parameters

  • cfg (EnvConfig | str) — Either an EnvConfig object describing the environment to build locally, or a Hugging Face Hub repository identifier (e.g. "username/repo"). In the latter case, the repo must include a Python file (usually env.py).
  • n_envs (int, optional) — The number of parallelized env to return. Defaults to 1.
  • use_async_envs (bool, optional) — Whether to return an AsyncVectorEnv or a SyncVectorEnv. Defaults to False.
  • hub_cache_dir (str | None) — Optional cache path for downloaded hub files.
  • trust_remote_code (bool) — Explicit consent to execute remote code from the Hub. Default False — must be set to True to import/exec hub env.py.

Returns

dict[str, dict[int, gym.vector.VectorEnv]]

A mapping from suite name to indexed vectorized environments.

  • For multi-task benchmarks (e.g., LIBERO): one entry per suite, and one vec env per task_id.
  • For single-task environments: a single suite entry (cfg.type) with task_id=0.

Raises

ValueError or ModuleNotFoundError

  • ValueError — if n_envs < 1
  • ModuleNotFoundError — If the requested env package is not installed

Makes a gym vector environment according to the config or Hub reference.

make_env_config

lerobot.envs.make_env_config

< >

( env_type: str**kwargs )

Update on GitHub