nvlabs/alpamayo-recipes/alpamayo1-sft
Claude Code and agent skill by nvlabs/alpamayo-recipes
- community
Checking that the SKILL.md file is still in the repository.
Run end-to-end supervised fine-tuning (SFT) of the Alpamayo-1 VLM action model on the Physical AI AV (PAI) dataset. The agent collects a small set of choices from the user up front (PAI chunk range, CoC reasoning toggle, W&B preference, which stage(s) to run, dataset/checkpoint paths), then drives the whole pipeline. Use when an agent must run Stage 1 VLM SFT, Stage 2 trajectory-diffusion expert, or both on a multi-GPU host or cluster; when setting up the `a1_sft` uv venv from scratch; when overriding Hydra config (cameras, chunk IDs, learning rate, DeepSpeed); when evaluating a Stage-2 checkpoint against `val/metric/min_ade`; when diagnosing common SFT failures (flash-attn dtype warnings, wandb 403, DeepSpeed grad-accum mismatch, `use_cache` checkpointing warnings). Trigger keywords: alpamayo, alpamayo-1, alpamayo1, sft, post-train, post-training, fine-tune, finetune, vlm, action expert, trajectory diffusion, reasoning vla, qwen3-vl, qwen3, pai, physical_ai_av, physicalai-autonomous-vehicles, hydra, omegaconf, deepspeed, zero2, torchrun, accelerate, flash-attn, flash attention, transformers, huggingface, Alpamayo-R1-10B, min_ade, ade, corner_distance, CoC, chain of causation, reasoning labels, ood_reasoning, wandb, hydra override, hydra full error, use_cache, gradient checkpointing, ddp_find_unused_parameters, pretrained_model_name_or_path, stage1_vlm_checkpoint_path, uv sync.
Install
npx vskill@latest install nvlabs/alpamayo-recipes/alpamayo1-sftSKILL.md
The same SKILL.md was published earlier as nvlabs/alpamayo-recipes/alpamayo1-sft.
Alpamayo-1 SFT (Post-training)
This skill teaches an agent to fine-tune Alpamayo-1 end-to-end on the PAI (Physical AI Autonomous Vehicles) dataset using the recipe at recipes/alpamayo1_sft/. The recipe is a two-stage Hugging Face / Hydra / DeepSpeed pipeline:
- Stage 1 fine-tunes the full Qwen3-VL base VLM to emit discrete
trajectory tokens.
- Stage 2 freezes the Stage-1 VLM and trains the **trajectory-diffusion
action expert** on top.
Both stages share one entry point (train_hf.py) and one base config (configs/sft_base.yaml). Evaluation runs through evaluate_hf.py. Validated on 8× H100 80 GB.
Table of Contents
- When to use this skill
- Inputs to collect from the user (ask once, up front)
- Mental model — what gets trained, in what order
- Install — `a1_sft` venv
- Dataset & checkpoint
- Stage 1 — VLM SFT
- Stage 2 — Action expert (trajectory diffusion)
- Evaluation
- Logging — W&B, TensorBoard, offline
- Multi-GPU, multi-node, and cluster runs
- Hydra override cheatsheet
- Common failure modes (and the fix)
- Additional resources
When to use this skill
| You want to… | Use | |
|---|---|---|
Run a complete SFT pipeline on PAI from a pretrained Alpamayo-R1-10B | The whole skill — Stage 1 → Stage 2 → eval | |
| Fine-tune only the VLM | Stage 1 | |
| Train only the action expert against an existing Stage-1 checkpoint | Stage 2 | |
| Evaluate a checkpoint without further training | Evaluation | |
| Add CoC reasoning labels to Stage 1 | Stage 1 — CoC reasoning | |
| Run on a different camera / chunk subset | Hydra override cheatsheet | |
| Disable wandb (e.g. on a node with no internet or wrong team) | Logging |
If you're driving the model from the inference / serving side instead of training it, this is the wrong skill — use the alpamayo_r1 inference docs in the upstream repo.
Inputs to collect from the user (ask once, up front)
Before any download, install, or training step, ask the user for the following. Confirm all answers before proceeding. If running in a context where you cannot ask the user, halt and report rather than guess.
| Input | Why you need it | Default if user has no preference | |
|---|---|---|---|
PAI chunk range (e.g. 0-10) | Sets both the download_pai.py --chunk-ids flag and the Hydra data.{train,val}_dataset.chunk_ids overrides. For full-scale runs use 0-99; for smoke tests 0-1 (single chunk). | Ask explicitly; do not assume | |
Train / val split inside that range (e.g. train 0-9, val 9-10) | The recipe wants distinct train/val chunk ranges within what you've downloaded. For a single-chunk smoke test, both sides use the same range. | train = all but last, val = last | |
CoC reasoning labels enabled? (yes / no) | Toggles the components_order / components_prompt / label_components lists in configs/vla_processor/default.yaml and triggers the reasoning-label download path. | no | |
W&B logging? (yes / no) | If yes, also collect: WANDB_API_KEY, team, project. If no, agent sets WANDB_MODE=disabled and leaves the shipped config (report_to: none) untouched. | no | |
Stage(s) to run (stage1 / stage2 / both / eval) | Determines which torchrun -m alpamayo1_sft.train_hf --config-name ... (and/or evaluate_hf) invocations the agent issues. | both then eval | |
| PAI dataset directory | Used as --output-dir for download_pai.py and as data.{train,val}_dataset.local_dir. | Ask — no safe default | |
| Pretrained checkpoint directory | Used as huggingface-cli download --local-dir target and as model.checkpoint_path (Stage 1) / model.pretrained_model_name_or_path (Stage 2). | Ask — no safe default | |
| Conditional: Stage-1 checkpoint | Only if Stage(s) = stage2 or eval. Path to an existing output_stage1/checkpoint-XXXX/ dir. | n/a | |
| Conditional: Stage-2 checkpoint | Only if Stage(s) = eval. Path to an existing output_stage2/checkpoint-XXXX/ dir. | n/a |
Suggested question flow
Ask all of these in a single round if your interface supports multi-question prompts; otherwise ask sequentially in the order above. Example phrasing:
- "Which PAI chunks should I download and train on? (e.g.
0-10for a
representative subset, 0-1 for a fast smoke test, 0-99 for full)"
- "Inside that range, how should I split train vs val? (e.g. for
0-10:
train 0-9, val 9-10)"
- "Enable CoC (chain-of-causation) reasoning labels in Stage 1? (yes/no)"
- "Log to W&B? If yes, paste
WANDB_API_KEY, and tell me the team and
project. If no, I'll disable W&B."
- "Which stage(s) should I run? (
stage1,stage2,both, oreval)" - "Where should PAI live (or where is it already)?"
- "Where should
Alpamayo-R1-10B/live (or where is it already)?" - (If Stage 2 only / eval only:) "Path to your existing Stage-1
checkpoint?"
- (If eval only:) "Path to your existing Stage-2 checkpoint?"
Capture the answers verbatim
Save the answers as shell variables (or equivalent) at the top of your run log — every later command references them:
After this, do not ask the user further questions — run the rest of the pipeline end-to-end. The only acceptable mid-run halt conditions are: hard-stop errors (CUDA OOM, missing files, hydra errors), or the user explicitly interrupting.
Mental model — what gets trained, in what order
Key facts an agent must internalise before running anything:
- Same entry point both stages.
alpamayo1_sft.train_hfreads
--config-name sft_stage{1,2}. The stage difference is purely in the Hydra config (configs/sft_stage1.yaml, configs/sft_stage2.yaml), which compose on top of configs/sft_base.yaml.
- Stage 1 ≠ Stage 2 model class. Stage 1 instantiates
TrainableReasoningVLA.from_alpamayo_checkpoint (loads VLM weights from a local directory — the HF-downloaded Alpamayo-R1-10B/ folder). Stage 2 instantiates TrainableAlpamayoR1.from_pretrained and also needs the same local model directory plus the Stage-1 output as stage1_vlm_checkpoint_path.
- DeepSpeed only in Stage 1. Stage 2 turns DeepSpeed off
(trainer.deepspeed: null) and enables ddp_find_unused_parameters=true (the diffusion expert leaves parts of the graph unused per step).
- Required overrides (no defaults provided).
model.checkpoint_path(S1)
/ model.pretrained_model_name_or_path (S2) and both data.{train,val}_dataset.local_dir use Hydra's ??? mandatory sentinel — the run will error out at Hydra time if you forget them.
- PAI chunk split is by default
train: "0-99",val: "99-100"(see
sft_base.yaml:12-22) — i.e. one held-out chunk. Override on the CLI for smoke tests.
Install — a1_sft venv
This recipe builds a single uv venv at recipes/alpamayo1_sft/a1_sft/. uv handles everything; do not create a separate conda env.
Non-interactive harnesses (agents, CI, `bash -c "..."` per step): theexport PATH=...above only persists for the current shell. Eitherappend the line to~/.bashrconce, or re-export it at the top of everynon-interactive shell that callsuv. Forgetting this is the most commonreason a subsequent step reportsuv: command not found.
What uv sync resolves:
alpamayo_r1from
`github.com/NVlabs/alpamayo` (see pyproject.toml:51-53).
alpamayo-recipeseditable from../../src/(the recipe-side utilities).torch==2.8.0,transformers==4.57.1,deepspeed==0.18.2,
flash-attn>=2.8.3 (built without isolation per pyproject.toml:48-49).
After every uv sync, verify the import contract the recipe assumes — this is the single most common cause of opaque Hydra InstantiationExceptions (see pitfalls):
Dataset & checkpoint
PAI dataset
Use `$CHUNK_RANGE` from the user's answers (see Inputs).
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingrecipes/alpamayo1_sft/SKILL.md
Popularity
- Repository stars
- 191
- Repository forks
- 43
- 7-day trend score
- 26
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nvlabs/alpamayo-recipes/alpamayo1-sft)