Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:ARISE Initiative Robomimic FileUtils env from checkpoint

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

Overview

Concrete tool for creating simulation environments from checkpoint metadata provided by the robomimic file utilities module.

Description

The env_from_checkpoint function extracts env_metadata and shape_metadata from a checkpoint, creates an environment via EnvUtils.create_env_from_metadata, recovers the config for wrapping, and applies EnvUtils.wrap_env_from_config to add any environment wrappers. It automatically enables off-screen rendering when the model was trained with image observations.

Usage

Call this function after policy_from_checkpoint to create the evaluation environment. Reuse the ckpt_dict from policy loading to avoid redundant disk reads.

Code Reference

Source Location

  • Repository: robomimic
  • File: robomimic/utils/file_utils.py
  • Lines: L447-489

Signature

def env_from_checkpoint(ckpt_path=None, ckpt_dict=None, env_name=None,
                        render=False, render_offscreen=False, verbose=False):
    """
    Creates an environment using the metadata saved in a checkpoint.

    Args:
        ckpt_path (str): Path to checkpoint file
        ckpt_dict (dict): Loaded model checkpoint dictionary
        env_name (str): if provided, override environment name
        render (bool): if True, enable on-screen rendering
        render_offscreen (bool): if True, enable off-screen rendering
        verbose (bool): if True, print environment info

    Returns:
        env (EnvBase instance): environment matching training conditions
        ckpt_dict (dict): loaded checkpoint dictionary
    """

Import

import robomimic.utils.file_utils as FileUtils

# Call as:
env, ckpt_dict = FileUtils.env_from_checkpoint(ckpt_dict=ckpt_dict, render_offscreen=True)

I/O Contract

Inputs

Name Type Required Description
ckpt_path str No Path to .pth checkpoint (provide this or ckpt_dict)
ckpt_dict dict No Pre-loaded checkpoint dictionary
env_name str No Override environment name from checkpoint
render bool No Enable on-screen rendering. Default: False
render_offscreen bool No Enable off-screen rendering. Default: False (auto-enabled for image policies)
verbose bool No Print environment info. Default: False

Outputs

Name Type Description
env EnvBase Environment instance matching training conditions, with wrappers applied
ckpt_dict dict Loaded checkpoint dictionary

Usage Examples

Create Environment for Evaluation

import robomimic.utils.file_utils as FileUtils

# Load policy and reuse checkpoint dict
policy, ckpt_dict = FileUtils.policy_from_checkpoint(ckpt_path="model.pth")
env, _ = FileUtils.env_from_checkpoint(ckpt_dict=ckpt_dict, render_offscreen=True)

# Run evaluation
obs = env.reset()
policy.start_episode()
for step in range(400):
    action = policy(ob=obs)
    obs, reward, done, info = env.step(action)
    if done:
        break

Related Pages

Implements Principle

Requires Environment

Page Connections

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