Skip to main content

Diffusion Policy Model Training

Diffusion Policy models action sequences as a conditional denoising process, which suits control tasks that are continuous and smooth and that have multiple feasible trajectories. LeRobot provides a PyTorch implementation, and Embodiflow registers this policy under the model identifier diffusion, with LeRobot as the training framework and LeRobot v2 or v3 datasets as input.

Roles and Prerequisites​

Roles​

RoleScenarioDependency
Algorithm engineerFine-tune the diffusion policy for continuous-trajectory tasksTraining and dataset module permissions
Project ManagerTrack the progress and artifacts of diffusion policy training tasksTraining task view permission
Data providerProvide datasets with consistent fields and frame rateData export module permissions

Prerequisites​

ItemRequirement
Dataset versionLeRobot v2 or v3
Training frameworkLeRobot
Dataset fieldsThe image, state, and action fields in meta/info.json are complete, and the field names match the training configuration
Temporal consistencyfps matches the actual recording to avoid misaligned supervision signals
Compute resourcesA GPU; VRAM requirements vary with batch_size, image resolution, and the number of observation steps

Training Task Creation and Parameters​

Procedure​

  1. Create a training task on the training page and select diffusion as the model.
  2. Choose a data source and the dataset version v2 or v3.
  3. Select LeRobot as the training framework.
  4. Configure the common parameters and the policy parameters.
  5. Choose the compute resources and submit the task.

Training Parameters​

Common parameters:

ParameterDescriptionDefaultRange
batch_sizeBatch size1≥ 1
stepsNumber of training steps10000≥ 1
seedRandom seed1000Integer
num_workersNumber of DataLoader workers4≥ 1
eval_freqEvaluation frequency, in steps1000≥ 1
log_freqLog frequency, in steps100≥ 1
save_checkpointWhether to save checkpointstrueBoolean
save_freqCheckpoint save frequency, in steps5000≥ 1

Policy parameters (prefixed with policy.):

ParameterDescriptionDefaultRange
policy.n_obs_stepsNumber of observation steps fed to the policy2Positive integer
policy.horizonAction prediction horizon16Positive integer
policy.n_action_stepsNumber of action steps executed per call8Positive integer
policy.vision_backboneVision backboneresnet18resnet18, resnet34, resnet50, resnet101, resnet152
policy.pretrained_backbone_weightsPretrained weights for the backboneEmptyA path or empty
policy.crop_shapeImage crop size before the backbone[84, 84]2-tuple
policy.crop_is_randomWhether to crop randomly during trainingtrueBoolean
policy.use_group_normReplace BatchNorm with GroupNorm in the backbonetrueBoolean
policy.spatial_softmax_num_keypointsNumber of SpatialSoftmax keypoints32Positive integer
policy.use_separate_rgb_encoder_per_cameraWhether each camera uses a separate RGB encoderfalseBoolean
policy.down_dimsFeature dimensions at each Unet downsampling stage[512, 1024, 2048]3-tuple
policy.kernel_sizeUnet convolution kernel size5Positive integer
policy.n_groupsNumber of GroupNorm groups in Unet convolution blocks8Positive integer
policy.diffusion_step_embed_dimDimension of the diffusion timestep embedding128Positive integer
policy.use_film_scale_modulationUse FiLM for Unet conditioningtrueBoolean
policy.noise_scheduler_typeNoise scheduler typeDDPMDDPM, DDIM
policy.num_train_timestepsNumber of forward diffusion steps100Positive integer
policy.beta_scheduleBeta schedulesquaredcos_cap_v2String
policy.beta_startBeta at the first forward diffusion step0.0001Float
policy.beta_endBeta at the last forward diffusion step0.02Float
policy.prediction_typeUnet prediction targetepsilonepsilon, sample
policy.clip_sampleWhether to clip predicted samplestrueBoolean
policy.clip_sample_rangeMagnitude of the clipping range1.0Float
policy.num_inference_stepsNumber of reverse diffusion steps at inferenceEmptyPositive integer or empty
policy.do_mask_loss_for_paddingMask the loss for zero-padded actionsfalseBoolean
policy.drop_n_last_framesNumber of trailing frames to drop7Integer
policy.optimizer_lrOptimizer learning rate1e-4Float
policy.optimizer_betasAdam optimizer betas[0.95, 0.999]2-tuple
policy.optimizer_epsAdam optimizer epsilon1e-8Float
policy.optimizer_weight_decayWeight decay1e-6Float
policy.scheduler_nameLearning rate schedulercosineString
policy.scheduler_warmup_stepsNumber of scheduler warmup steps500Non-negative integer

To validate the data pipeline for the first time, set batch_size and steps to small values, confirm that fields are read and the loss decreases, and then scale up to full training.

Verification​

Training Monitoring​

The platform parses the following metrics from LeRobot training logs:

MetricMeaning
lossTraining loss
stepTraining step
sampleNumber of samples used
episodeNumber of episodes used
epochTraining epoch
gradient_normGradient norm
learning_rateLearning rate
update_timeUpdate time per step
data_timeData loading time per step

Verification Checklist​

CheckPass criteria
Checkpoint listCheckpoints appear on the training details page according to save_freq
Loss curveloss decreases over training
LogsThe training logs show no persistent errors
Real-robot or simulation evaluationExecution results are stable across multiple rollouts under the same initial conditions

Error Handling​

SymptomPossible causeActionOwner
Field key mismatchThe image, state, and action field names in meta/info.json do not match the training configurationCheck and align the field names and fpsData provider
Out of VRAMbatch_size is too large, or the image resolution and observation steps are too highLower batch_size and first validate with fewer stepsTraining configuration owner
Loss does not decreaseThe learning rate or data window is configured incorrectlyCheck policy.optimizer_lr, policy.horizon, and policy.n_obs_stepsAlgorithm engineer
Results differ from the original paperThe LeRobot implementation, data reading, and preprocessing differUse the LeRobot implementation as the reference, or switch to the original implementationAlgorithm engineer
PagePurpose
Model trainingCreate, monitor, and quota training tasks
LeRobot datasets and trainingData export and training overview
LeRobot v2 and v3 format differencesDifferences and migration between the two data formats
Data exportGenerate a LeRobot training package