mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-26 03:06:01 +00:00
fix(peft): allow fresh LoRA fine-tuning from a base-model checkpoint
This commit is contained in:
@@ -111,17 +111,26 @@ Requirements:
|
||||
- The block-causal masks use PyTorch **flex-attention**, so build the policy with
|
||||
`--policy.attn_mode=flex` for training (the default `torch` SDPA is inference-only).
|
||||
- The full 5B DiT does not fit a single 24–32 GB GPU under AdamW; fine-tune with **LoRA**
|
||||
(`--policy.use_peft=true`) and/or optimizer offload. `get_optim_params` returns only the
|
||||
trainable (e.g. adapter) parameters; the VAE + UMT5 text encoder stay frozen.
|
||||
(`--peft.method_type=LORA`) and/or optimizer offload. `get_optim_params` returns only the
|
||||
trainable (e.g. adapter) parameters; the VAE + UMT5 text encoder stay frozen. Install the
|
||||
`lerobot[peft]` extra to enable PEFT support (see the [PEFT training guide](./peft_training)).
|
||||
|
||||
```bash
|
||||
lerobot-train \
|
||||
--policy.path=lerobot/lingbot_va_libero_long --policy.attn_mode=flex \
|
||||
--policy.use_peft=true \
|
||||
--peft.method_type=LORA --peft.r=32 --peft.lora_alpha=32 \
|
||||
--peft.target_modules='transformer\.blocks\.\d+\.attn[12]\.(to_q|to_v)' \
|
||||
--dataset.repo_id=<your LeRobot-format dataset> \
|
||||
--batch_size=1 --steps=... --output_dir=outputs/train/lingbot_va
|
||||
```
|
||||
|
||||
Unlike SmolVLA / π₀, LingBot-VA does not ship built-in default LoRA targets, so you must pass
|
||||
`--peft.target_modules` explicitly. Only `self.transformer` (the dual-stream Wan transformer) is
|
||||
trainable; the example above adapts the query/value projections of both its self-attention
|
||||
(`attn1`) and cross-attention (`attn2`) blocks — the standard LoRA target set. Broaden it (e.g.
|
||||
add `to_k`/`to_out`, or the `ffn` layers) if you need a higher-capacity adapter. Passing
|
||||
`--peft.method_type` implies PEFT, so `--policy.use_peft=true` is not required.
|
||||
|
||||
The dataset must provide camera clips (a temporal window per camera, VAE-encoded to
|
||||
`frame_chunk_size` latent frames) and `frame_chunk_size * action_per_frame` action steps per item.
|
||||
|
||||
|
||||
@@ -62,3 +62,10 @@ to the `--peft.full_training_modules` parameter:
|
||||
|
||||
The learning rate and the scheduled target learning rate can usually be scaled by a factor of 10 compared to the
|
||||
learning rate used for full fine-tuning (e.g., 1e-4 normal, so 1e-3 using LoRA).
|
||||
|
||||
## Other policies
|
||||
|
||||
The same `--peft.*` flags work for any pre-trained policy. Some policies (SmolVLA, π₀, π₀.₅) ship
|
||||
built-in default `target_modules`, so `--peft.method_type=LORA` is enough. Others do not, and will
|
||||
ask you to pass `--peft.target_modules` explicitly — for example LingBot-VA, whose recommended
|
||||
targets are documented in its [dedicated guide](./lingbot_va#training--fine-tuning).
|
||||
|
||||
Reference in New Issue
Block a user