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 BaselineRegistry

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

Overview

BaselineRegistry extends Habitat's core Registry to provide a centralized registration mechanism for trainers, policies, observation transformers, auxiliary losses, storage backends, agent access managers, and updaters.

Description

BaselineRegistry is a class-level registry pattern that enables decoupled, extensible registration and lookup of baseline components. It provides paired register_* and get_* class methods for seven component types: trainers, policies, observation transformers, auxiliary losses, storage, agent access managers, and updaters. Each registration method accepts an optional name parameter; if omitted, the registered class name is used as the key. Registration methods also perform type assertions to ensure that registered classes inherit from the expected base types (e.g., BaseTrainer for trainers, Policy for policies). A module-level singleton baseline_registry is provided for convenient access throughout the codebase.

Usage

Use the baseline_registry singleton to register and retrieve custom components. Apply the decorator form to register a class at import time, or call the register method directly.

Code Reference

Source Location

Signature

class BaselineRegistry(Registry):
    @classmethod
    def register_trainer(cls, to_register=None, *, name: Optional[str] = None):
    @classmethod
    def get_trainer(cls, name):
    @classmethod
    def register_policy(cls, to_register=None, *, name: Optional[str] = None):
    @classmethod
    def get_policy(cls, name: str):
    @classmethod
    def register_obs_transformer(cls, to_register=None, *, name: Optional[str] = None):
    @classmethod
    def get_obs_transformer(cls, name: str):
    @classmethod
    def register_auxiliary_loss(cls, to_register=None, *, name: Optional[str] = None):
    @classmethod
    def get_auxiliary_loss(cls, name: str):
    @classmethod
    def register_storage(cls, to_register=None, *, name: Optional[str] = None):
    @classmethod
    def get_storage(cls, name: str):
    @classmethod
    def register_agent_access_mgr(cls, to_register=None, *, name: Optional[str] = None):
    @classmethod
    def get_agent_access_mgr(cls, name: str):
    @classmethod
    def register_updater(cls, to_register=None, *, name: Optional[str] = None):
    @classmethod
    def get_updater(cls, name: str):

Import

from habitat_baselines.common.baseline_registry import baseline_registry

I/O Contract

Inputs

Name Type Required Description
to_register class No The class to register. If used as a parameterless decorator, this is passed automatically.
name Optional[str] No Key under which the class is registered. Defaults to the class name if not specified.

Outputs

Name Type Description
(registered class or decorator) class or Callable When used as a decorator, returns the registered class unchanged. When called via get_*, returns the registered class.

Usage Examples

Registering a Policy

from habitat_baselines.common.baseline_registry import baseline_registry
from habitat_baselines.rl.ppo.policy import Policy

@baseline_registry.register_policy
class MyPolicy(Policy):
    pass

# Or with a custom name
@baseline_registry.register_policy(name="MyCustomPolicy")
class AnotherPolicy(Policy):
    pass

Retrieving a Registered Trainer

from habitat_baselines.common.baseline_registry import baseline_registry

trainer_cls = baseline_registry.get_trainer("PPOTrainer")
trainer = trainer_cls(config=my_config)

Registering an Observation Transformer

from habitat_baselines.common.baseline_registry import baseline_registry
from habitat_baselines.common.obs_transformers import ObservationTransformer

@baseline_registry.register_obs_transformer
class MyObsTransformer(ObservationTransformer):
    pass

Related Pages

Page Connections

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