LeRobot documentation
Environments
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
< source >( 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 {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.
Return (preprocessor, postprocessor) for this env. Default: identity.
make_env
lerobot.envs.make_env
< source >( 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
EnvConfigobject 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 (usuallyenv.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 < 1ModuleNotFoundError— If the requested env package is not installed
Makes a gym vector environment according to the config or Hub reference.