Run this model with HF Jobs

Run mohsinarf/flow_matching_unet_pusht on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/mohsinarf/flow_matching_unet_pusht. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/mohsinarf/flow_matching_unet_pusht on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Flow Matching policy for PushT (flow_matching_unet)

A visuomotor Flow Matching policy for the PushT task, trained on lerobot/pusht with LeRobot 0.6.1.

The policy uses the same ResNet18 encoder and 1-D conditional UNet as LeRobot's Diffusion Policy (the classes are imported from LeRobot, not copied). Only the generative objective differs, so it is a like-for-like comparison of flow matching against diffusion on the same network.

With 16 Euler steps this checkpoint reaches 74 % success at the 0.95 coverage threshold over 50 evaluation episodes. The mean over three training seeds is 65.3 ± 10.3 %, the same as Diffusion Policy with DDIM 10 trained under the same budget (65.3 ± 4.2 %). This checkpoint is seed 1, the best of the three.

Method

  • Training: conditional optimal-transport path x_t = (1 - t) * noise + t * action with t uniform in [0, 1]. The UNet predicts the velocity action - noise and is trained with MSE.
  • Inference: start from Gaussian noise and integrate the predicted velocity from t = 0 to t = 1 with fm_num_steps fixed Euler steps (a midpoint solver is also available). The final sample is clamped to [-1, 1].
  • Time embedding: t is multiplied by 100 before the UNet's sinusoidal step embedding, so [0, 1] spans the same range as Diffusion's 100 integer timesteps.
Inputs observation.image 96 x 96 RGB (random 84 x 84 crop in training, centre crop at evaluation), observation.state (agent x, y)
Output action (target agent x, y), in chunks
Observation steps 2
Horizon / executed steps 16 / 8
Vision encoder ResNet18, GroupNorm, spatial softmax with 32 keypoints, no pretrained weights
UNet down dims 512 / 1024 / 2048, kernel 5, FiLM conditioning
Parameters 262.7 M
Normalisation MIN_MAX for state and action, MEAN_STD for images

Training

Dataset lerobot/pusht
Steps / batch size 100 000 / 64
Optimiser Adam, learning rate 1e-4, betas (0.95, 0.999), weight decay 1e-6
Schedule cosine, 500 warm-up steps
Seed 1
Hardware one RTX 5090, 2.2 h, 5.0 GB peak VRAM

The full configuration is in train_config.json.

Results

Evaluation: gym-pusht, 50 fixed episodes (environment seeds from 100000), success = maximum coverage of the goal at or above the threshold within the episode. Latency is one model call at batch size 1 on the RTX 5090, without pre- and post-processing.

This checkpoint (seed 1). The number of solver steps is chosen at inference, so one checkpoint covers the whole speed and quality range:

Euler steps Success at 0.95 Success at 0.90 Avg max coverage Latency (ms)
1 44 % 82 % 0.83 4.9
2 50 % 78 % 0.84 8.8
4 60 % 84 % 0.88 16.7
8 (config default) 60 % 90 % 0.89 32.4
16 74 % 90 % 0.91 62.5

Mean ± standard deviation over three training seeds, with Diffusion Policy trained with the same encoder, UNet, data, steps and batch size:

Policy Success at 0.95 Success at 0.90 Avg max coverage Latency p95 (ms)
Flow Matching, Euler 1 43.3 ± 3.1 81.3 ± 1.2 0.86 ± 0.02 4.9
Flow Matching, Euler 2 54.0 ± 4.0 81.3 ± 4.2 0.87 ± 0.03 8.8
Flow Matching, Euler 4 56.7 ± 3.1 83.3 ± 1.2 0.88 ± 0.01 16.7
Flow Matching, Euler 8 57.3 ± 12.2 88.7 ± 2.3 0.91 ± 0.02 32.4
Flow Matching, Euler 16 65.3 ± 10.3 88.0 ± 7.2 0.91 ± 0.01 63.4
Diffusion, DDIM 10 65.3 ± 4.2 88.7 ± 1.2 0.91 ± 0.00 40.5
Diffusion, DDPM 100 64.0 ± 12.2 88.7 ± 2.3 0.91 ± 0.02 382.1

For reference, the lerobot/diffusion_pusht model card reports 65.4 % at the 0.95 threshold (200 k steps, 500 episodes).

With 50 episodes per run, one episode is 2 points, and the spread between seeds is large (54 % to 74 % at Euler 16). Differences of a few points in these tables are within noise.

Usage

flow_matching_unet is not a built-in LeRobot policy type. The policy code lives in the movensys-imitation repository (devel branch, movensys_imitation/policies/flow_matching_unet/) and has to be importable so that the type is registered with LeRobot:

pip install "git+https://github.com/movensys/movensys-imitation@devel"

Load the policy in Python:

from movensys_imitation.policies.flow_matching_unet.modeling_flow_matching_unet import (
    FlowMatchingUnetPolicy,
)

policy = FlowMatchingUnetPolicy.from_pretrained("mohsinarf/flow_matching_unet_pusht")
policy.config.fm_num_steps = 16   # solver steps; 1 to 16 were evaluated
policy.eval()

Evaluate on gym-pusht (movensys-eval is LeRobot's eval script with the policy type registered):

movensys-eval --policy.path=mohsinarf/flow_matching_unet_pusht --policy.fm_num_steps=16 \
    --env.type=pusht --eval.n_episodes=50 --eval.batch_size=50 --eval.use_async_envs=false \
    --seed=100000 --output_dir=outputs/eval_flow_matching_euler16

Limitations

  • Trained and evaluated in the gym-pusht simulator only. It is not a real-robot policy.
  • Results come from 50 episodes per run and three seeds; this checkpoint is the best seed.
  • The checkpoint depends on LeRobot 0.6.1's Diffusion Policy classes and may not load with other LeRobot versions.

References

  • Lipman et al., Flow Matching for Generative Modeling, 2023.
  • Chi et al., Diffusion Policy: Visuomotor Policy Learning via Action Diffusion, 2023.
  • Black et al., π0: A Vision-Language-Action Flow Model for General Robot Control, 2024.
Downloads last month
35
Safetensors
Model size
0.3B params
Tensor type
F32
·
Video Preview
loading

Dataset used to train mohsinarf/flow_matching_unet_pusht

Evaluation results

  • Success rate, coverage >= 0.95, Euler 16 (50 episodes) on PushT
    self-reported
    74.000