Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Facebookresearch Habitat lab HabitatEnvFactory

From Leeroopedia
Revision as of 12:35, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Facebookresearch_Habitat_lab_HabitatEnvFactory.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Embodied_AI, Environment_Management
Last Updated 2026-02-15 00:00 GMT

Overview

HabitatVectorEnvFactory constructs vectorized Habitat environments by splitting scenes across parallel workers, configuring per-environment seeds and measurements, and optionally enabling batch rendering.

Description

HabitatVectorEnvFactory extends VectorEnvFactory and implements the construct_envs method. It loads the dataset to discover available scenes, shuffles them, and distributes scenes across the configured number of environments using a round-robin scheme. When there are fewer scenes than environments, it either reduces the environment count (if enforce_scenes_greater_eq_environments is True) or duplicates scenes across all environments. Each environment receives a unique seed (base seed plus environment index) and has certain rank-specific or rank0-env0-specific measurements filtered out depending on whether the environment is on the first rank. The factory supports both VectorEnv and ThreadedVectorEnv (selected via the HABITAT_ENV_DEBUG environment variable), and initializes a batch renderer if configured.

Usage

Use this factory to create parallel Habitat environments for RL or IL training. Pass a configuration that specifies the number of environments, dataset, and scene settings.

Code Reference

Source Location

Signature

class HabitatVectorEnvFactory(VectorEnvFactory):
    def construct_envs(
        self,
        config: "DictConfig",
        workers_ignore_signals: bool = False,
        enforce_scenes_greater_eq_environments: bool = False,
        is_first_rank: bool = True,
    ) -> VectorEnv:

Import

from habitat_baselines.common.habitat_env_factory import HabitatVectorEnvFactory

I/O Contract

Inputs

Name Type Required Description
config DictConfig Yes Full Hydra/OmegaConf configuration containing habitat and habitat_baselines settings
workers_ignore_signals bool No If True, worker processes ignore OS signals (default: False)
enforce_scenes_greater_eq_environments bool No If True and fewer scenes than environments, reduces the environment count rather than duplicating scenes (default: False)
is_first_rank bool No Whether this is rank 0 in distributed training; controls measurement filtering (default: True)

Outputs

Name Type Description
envs VectorEnv A vectorized environment with scenes distributed across parallel workers

Usage Examples

Basic Usage

from habitat_baselines.common.habitat_env_factory import HabitatVectorEnvFactory

factory = HabitatVectorEnvFactory()
envs = factory.construct_envs(
    config=my_config,
    workers_ignore_signals=True,
    is_first_rank=True,
)

observations = envs.reset()
# Use envs for training or evaluation
envs.close()

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment