Imitation Learning Workflow
Imitation learning (IL) collects demonstrations with collect and trains
policies offline with learn. Support depends on the task, dataset, and
algorithm. Robomimic requires one environment and compatible observation and
action data.
1. Collect Demonstrations
Reference:
srb agent collect— Collect Demonstrations
Teleoperate the task and discard failed attempts; keyboard save does not mark
a demo successful. --success_only keeps demos only when the ending episode’s
success flag or configured success termination term reports success (see
collection tips):
srb agent collect --env peg_in_hole --num_episodes 50
Keyboard is the default input. For 6-DoF input, use a SpaceMouse. An XR headset provides an immersive viewpoint; see XR headset guidance:
srb agent collect --env peg_in_hole --teleop_device spacemouse
Datasets default to
logs/<env_id>/collect/<timestamp>/datasets/demos_<timestamp>.hdf5. Set
--logdir to change the root.
2. Train an IL Policy
Reference:
srb agent learn— Learn from Demonstrations
See the srb agent learn reference
for its execution requirements.
srb agent learn --algo robomimic_bc --env peg_in_hole \
--dataset logs/peg_in_hole/collect/<timestamp>/datasets/demos_<timestamp>.hdf5
Pass --dataset explicitly; learn creates a fresh run and does not discover
data from earlier collect runs. The RNN variant uses the same workflow:
srb agent learn --algo robomimic_bc_rnn --env peg_in_hole \
--dataset logs/peg_in_hole/collect/<timestamp>/datasets/demos_<timestamp>.hdf5
Training verifies private dataset copies and checks allocation limits before reading them. See dataset admission and normalization.
HDF5 demos record dones, terminated, and truncated. Robomimic value
learners use dones for episode boundaries and currently treat truncations as
terminal.
3. Evaluate the Policy
Reference:
srb agent eval— Evaluate Agent
Evaluate with srb agent eval:
srb agent eval --algo robomimic_bc --env peg_in_hole env.num_envs=1
Robomimic uses one environment. Evaluation and collection reject
num_envs != 1; offlinelearndoes not create an environment.
- Success uses the task’s episode
successsignal; tasks without one reportsuccess_rate: nulland a warning. - When training uses
--normalize_actions, the checkpoint stores the action range used at evaluation. - Older checkpoints with
logs/normalization_params.txtrequire retraining; otherwise their normalization cannot be detected. - If no action range is detectable in checkpoint metadata, evaluation passes normalized policy actions to the environment without rescaling. Nested observations use the same slash-joined keys as training.
4. (Optional) Iterate
Augment with Policy Rollouts
Use a partially trained policy to collect demonstrations:
srb agent collect --algo robomimic_bc --env peg_in_hole \
--num_episodes 200
Merge the HDF5 files before training on multiple collection runs; learn
accepts one --dataset.
Combine with RL
IL checkpoints cannot warm-start RL because frameworks use different formats.
- Collect demonstrations with IL while training RL from scratch.
- Resume an RL run with
--continue_trainingor a same-framework--model. - Prefill SKRL or Dreamer replay from canonical demonstration exports; see SKRL and Dreamer requirements.
5. Deploy to Hardware
Reference: Sim-to-Real Transfer
Use the sim-to-real workflow when task, checkpoint, and hardware interfaces are compatible; hardware operation remains gated.
See Also
- Imitation Learning Integration — framework details
- Reinforcement Learning Workflow — complementary paradigm
- Extended Reality — high-fidelity demonstration source