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 ConfigGenerator

From Leeroopedia
Revision as of 11:58, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/ARISE_Initiative_Robomimic_ConfigGenerator.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Robotics, Experiment_Management, Hyperparameter_Optimization
Last Updated 2026-02-15 08:00 GMT

Overview

Concrete tool for defining hyperparameter sweep ranges and accumulating parameter configurations provided by the robomimic hyperparameter utilities module.

Description

The ConfigGenerator class provides methods for specifying base configurations and accumulating parameter sweep definitions. Its __init__ method sets up the base config file, output directories, and script file paths. Its add_param method registers a parameter with its config key, display name, group ID, and values into an OrderedDict.

Parameters with the same group ID have their values swept together (zipped), while different groups are crossed in a Cartesian product. The value_names parameter allows custom display names for experiment naming.

Usage

Instantiate a ConfigGenerator with a base config JSON file, then call add_param for each parameter to sweep. Finally call generate() to produce the configs and launch script.

Code Reference

Source Location

  • Repository: robomimic
  • File: robomimic/utils/hyperparam_utils.py
  • Lines: L14-78 (__init__ at L19-46, add_param at L48-78)

Signature

class ConfigGenerator(object):
    def __init__(self, base_config_file, base_exp_name=None, wandb_proj_name=None,
                 script_file=None, generated_config_dir=None):
        """
        Args:
            base_config_file (str): path to base JSON config
            base_exp_name (str): override base experiment name
            wandb_proj_name (str): W&B project name
            script_file (str): output shell script filename
            generated_config_dir (str): directory for generated JSON configs
        """

    def add_param(self, key, name, group, values, value_names=None,
                  hidename=False, prepend=False):
        """
        Add parameter to the hyperparameter sweep.

        Args:
            key (str): hierarchical config key (e.g., "train/batch_size")
            name (str): display name for experiment naming
            group (int): group ID for co-sweeping
            values (list): values to sweep over
            value_names (list): optional custom display names for values
            hidename (bool): hide this parameter from experiment name
            prepend (bool): prepend this parameter in experiment name
        """

Import

from robomimic.utils.hyperparam_utils import ConfigGenerator

I/O Contract

Inputs (Constructor)

Name Type Required Description
base_config_file str Yes Path to base JSON config file
base_exp_name str No Override experiment name. Default: from config
wandb_proj_name str No W&B project name
script_file str No Output shell script path. Default: ~/tmp/tmpp.sh
generated_config_dir str No Directory for generated JSON configs

Inputs (add_param)

Name Type Required Description
key str Yes Hierarchical config key (slash-separated)
name str Yes Display name in experiment name
group int Yes Group ID; same group = zipped, different = Cartesian
values list Yes Values to sweep over
value_names list No Custom display names for values
hidename bool No Hide from experiment name. Default: False
prepend bool No Prepend in experiment name. Default: False

Outputs

Name Type Description
self.parameters OrderedDict Accumulated parameter sweep definitions

Usage Examples

Define a Sweep

from robomimic.utils.hyperparam_utils import ConfigGenerator

# Create generator with base config
generator = ConfigGenerator(
    base_config_file="robomimic/exps/templates/bc.json",
    script_file="/tmp/sweep_bc.sh",
    generated_config_dir="/tmp/sweep_configs/",
)

# Sweep learning rate (group 1)
generator.add_param(
    key="algo/optim_params/policy/learning_rate/initial",
    name="lr",
    group=1,
    values=[1e-3, 1e-4],
)

# Sweep batch size (group 2 → crossed with lr)
generator.add_param(
    key="train/batch_size",
    name="bs",
    group=2,
    values=[100, 256],
)

# Co-sweep dataset path and name (same group 3 → zipped)
generator.add_param(
    key="train/data",
    name="ds",
    group=3,
    values=[
        [{"path": "lift_ph.hdf5"}],
        [{"path": "can_ph.hdf5"}],
    ],
    value_names=["lift", "can"],
)

# Generate all combinations: 2×2×2 = 8 configs
generator.generate()

Related Pages

Implements Principle

Page Connections

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