Downloads · 30 days
7
13% of all-time downloads
yianW/diffusion-vit-grasp03-20k
diffusion-vit-grasp03-20k is a robotics model from yianW. Use it for the robotics task on the model card, and read the license before you ship it in a product. It is set up for lerobot. The card lists the license as apache-2.0.
Diffusion Policy trained on yianW/grasp03-sim-real-halvedreal with the ResNet image backbone in lerobot's DiffusionPolicy swapped for a torchvision ViT-B/16 initialized from ImageNet weights.
Downloads · 30 days
7
13% of all-time downloads
All-time downloads
56
Public
Parameters
343M
1.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.4 GB · 100%
From the Hugging Face model README
Diffusion Policy trained on
yianW/grasp03-sim-real-halvedreal
with the ResNet image backbone in lerobot's DiffusionPolicy swapped for a
torchvision ViT-B/16 initialized from ImageNet weights.
This is the checkpoint at training step 20 000 / 25 000.
| File | Purpose |
|---|---|
config.json, model.safetensors, train_config.json, policy_*.{json,safetensors} | Standard lerobot pretrained-model files. |
lerobot_vit_patch.py | Monkey-patches lerobot to swap DiffusionRgbEncoder for a ViT and to accept vision_backbone="vit_*" in DiffusionConfig. Must be imported before loading. |
train_diffusion_vit.py | Self-contained training script: builds TrainPipelineConfig, applies the per-dim loss weighting, and calls lerobot.scripts.lerobot_train.train. Use this to retrain or fine-tune. |
import lerobot_vit_patch # noqa: F401 -- applies the ViT swap
from lerobot.policies.diffusion.modeling_diffusion import DiffusionPolicy
policy = DiffusionPolicy.from_pretrained("yianW/diffusion-vit-grasp03-20k")
policy.eval()
lerobot_vit_patch.py must be importable before from_pretrained runs.
The simplest way is to download it alongside the weights and put it on
PYTHONPATH, e.g.:
from huggingface_hub import hf_hub_download
import sys, importlib
sys.path.insert(0, hf_hub_download(
"yianW/diffusion-vit-grasp03-20k", "lerobot_vit_patch.py", repo_type="model"
).rsplit("/", 1)[0])
importlib.import_module("lerobot_vit_patch") # apply patch
from lerobot.policies.diffusion.modeling_diffusion import DiffusionPolicy
policy = DiffusionPolicy.from_pretrained("yianW/diffusion-vit-grasp03-20k")
vit_b_16, ImageNet pretrained (IMAGENET1K_V1), 86 M params.2 × spatial_softmax_num_keypoints so the Unet's global_cond_dim is
unchanged.ImageTransforms with brightness, contrast,
saturation, hue, sharpness, small affine — up to 3 sampled per frame.[5, 5, 5, 5, 5, 5, 5, 1, 1, ..., 1] so the arm contributes 5× compared
to the hand. See _weighted_compute_loss in train_diffusion_vit.py.prediction_type=epsilon,
n_obs_steps=2, horizon=16, n_action_steps=8.accelerate.| Step | Loss | LR |
|---|---|---|
| 100 | 1.98 | 1.0e-5 |
| 1 000 | 0.05 | 1.0e-4 |
| 5 000 | 0.014 | 9.2e-5 |
| 10 000 | 0.008 | 6.9e-5 |
| 15 000 | 0.005 | 3.7e-5 |
| 20 000 | 0.002 | 1.1e-5 |
Pinned versions used for this checkpoint:
| Package | Version |
|---|---|
| Python | 3.12 |
lerobot | 0.5.1 |
torch | 2.10.0 (cu128) |
torchvision | 0.25.0 (cu128) |
huggingface_hub | 1.8.0 |
Setup with uv:
uv venv /venv/main --python 3.12
VIRTUAL_ENV=/venv/main uv pip install \
"torch==2.10.0" "torchvision==0.25.0" \
"lerobot==0.5.1" "huggingface_hub>=1.0"
(GPU: 1× A100-80GB used here; any A100-class card with ≥40 GB should work
with batch_size=64. On 80 GB use batch_size=128.)
Pull the patch + training script from this repo, drop them in your working directory, then launch:
huggingface-cli download yianW/diffusion-vit-grasp03-20k \
lerobot_vit_patch.py train_diffusion_vit.py \
--local-dir .
/venv/main/bin/python train_diffusion_vit.py
train_diffusion_vit.py is self-contained — it builds the
TrainPipelineConfig programmatically (dataset, ViT backbone, augmentation,
crop/resize, per-dim loss weighting) and calls lerobot's training loop.
Edit the build_train_config() / build_policy_config() functions in that
file to change steps, batch size, lr, etc.
Pass --policy.path=yianW/diffusion-vit-grasp03-20k to lerobot's CLI, or
modify build_policy_config() to use from_pretrained. Note the patch must
still be applied first.
The optimizer / scheduler / RNG state needed to resume training mid-run
(training_state/, ~2.6 GB) is not uploaded here — only the inference
weights are. If you need it for an exact resume, ask and it can be added.
lerobot.policies.diffusion.modeling_diffusion.DiffusionRgbEncoder) is
recommended.