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:ARISE Initiative Robomimic Config factory

From Leeroopedia
Knowledge Sources
Domains Robotics, Configuration
Last Updated 2026-02-15 08:00 GMT

Overview

Concrete tool for creating algorithm-specific configuration objects provided by the robomimic configuration module.

Description

The config_factory function is the primary entry point for creating experiment configurations in robomimic. It looks up the algorithm name in a global registry (REGISTERED_CONFIGS) populated by the ConfigMeta metaclass, and returns an instance of the corresponding BaseConfig subclass. If a dictionary is provided (e.g., loaded from a JSON file), the config is instantiated from that dictionary.

Usage

Import this function at the start of any training, evaluation, or sweep script when you need to create a config object from an algorithm name string. Use it when loading config from a JSON file or when programmatically constructing experiment parameters.

Code Reference

Source Location

  • Repository: robomimic
  • File: robomimic/config/base_config.py
  • Lines: L24-32

Signature

def config_factory(algo_name, dic=None):
    """
    Creates an instance of a config from the algo name. Optionally pass
    a dictionary to instantiate the config from the dictionary.

    Args:
        algo_name (str): the algorithm name (e.g., "bc", "bcq", "cql", "iql", "td3_bc",
                         "diffusion_policy", "gl", "hbc", "iris")
        dic (dict): optional dictionary to instantiate config from (e.g., loaded from JSON)

    Returns:
        BaseConfig: a locked config subclass instance with all experiment/train/algo parameters
    """

Import

from robomimic.config import config_factory

I/O Contract

Inputs

Name Type Required Description
algo_name str Yes Algorithm name string (e.g., "bc", "bcq", "cql", "iql", "td3_bc", "diffusion_policy", "gl", "hbc", "iris")
dic dict No Optional dictionary to instantiate config from; typically loaded from a JSON file

Outputs

Name Type Description
config BaseConfig subclass A locked config instance (e.g., BCConfig, BCQConfig) with all experiment, training, observation, and algorithm parameters

Usage Examples

Create Default Config

from robomimic.config import config_factory

# Create a default BC config
config = config_factory(algo_name="bc")

# Access parameters with attribute syntax
config.experiment.name = "my_bc_experiment"
config.train.num_epochs = 100
config.train.batch_size = 128

Load Config from JSON

import json
from robomimic.config import config_factory

# Load config from a JSON template
with open("robomimic/exps/templates/bc.json", "r") as f:
    ext_cfg = json.load(f)

# Create config from the loaded dictionary
config = config_factory(algo_name="bc", dic=ext_cfg)

Programmatic Config Setup (from train.py)

import json
from robomimic.config import config_factory

# Load external config JSON
with open(args.config, "r") as f:
    ext_cfg = json.load(f)

# Create config and update from external settings
config = config_factory(ext_cfg["algo_name"])
with config.values_unlocked():
    config.update(ext_cfg)

# Lock config to prevent accidental modifications
config.lock()

Related Pages

Implements Principle

Page Connections

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