nvlabs/alpamayo-recipes/alpamayo1-sft

Claude Code and agent skill by nvlabs/alpamayo-recipes

Trust tier 2
  • community
LLM review pending
Source check pending

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-sft

SKILL.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:

  1. Stage 1 fine-tunes the full Qwen3-VL base VLM to emit discrete

trajectory tokens.

  1. 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

  1. When to use this skill
  2. Inputs to collect from the user (ask once, up front)
  3. Mental model — what gets trained, in what order
  4. Install — `a1_sft` venv
  5. Dataset & checkpoint
  6. Stage 1 — VLM SFT
  7. Stage 2 — Action expert (trajectory diffusion)
  8. Evaluation
  9. Logging — W&B, TensorBoard, offline
  10. Multi-GPU, multi-node, and cluster runs
  11. Hydra override cheatsheet
  12. Common failure modes (and the fix)
  13. Additional resources

When to use this skill

You want to…Use
Run a complete SFT pipeline on PAI from a pretrained Alpamayo-R1-10BThe whole skill — Stage 1 → Stage 2 → eval
Fine-tune only the VLMStage 1
Train only the action expert against an existing Stage-1 checkpointStage 2
Evaluate a checkpoint without further trainingEvaluation
Add CoC reasoning labels to Stage 1Stage 1 — CoC reasoning
Run on a different camera / chunk subsetHydra 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.

InputWhy you need itDefault 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 directoryUsed as --output-dir for download_pai.py and as data.{train,val}_dataset.local_dir.Ask — no safe default
Pretrained checkpoint directoryUsed 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 checkpointOnly if Stage(s) = stage2 or eval. Path to an existing output_stage1/checkpoint-XXXX/ dir.n/a
Conditional: Stage-2 checkpointOnly 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:

  1. "Which PAI chunks should I download and train on? (e.g. 0-10 for a

representative subset, 0-1 for a fast smoke test, 0-99 for full)"

  1. "Inside that range, how should I split train vs val? (e.g. for 0-10:

train 0-9, val 9-10)"

  1. "Enable CoC (chain-of-causation) reasoning labels in Stage 1? (yes/no)"
  2. "Log to W&B? If yes, paste WANDB_API_KEY, and tell me the team and

project. If no, I'll disable W&B."

  1. "Which stage(s) should I run? (stage1, stage2, both, or eval)"
  2. "Where should PAI live (or where is it already)?"
  3. "Where should Alpamayo-R1-10B/ live (or where is it already)?"
  4. (If Stage 2 only / eval only:) "Path to your existing Stage-1

checkpoint?"

  1. (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:

bash
export CHUNK_RANGE="0-10" # full download span
export TRAIN_CHUNKS="0-9" # data.train_dataset.chunk_ids
export VAL_CHUNKS="9-10" # data.val_dataset.chunk_ids
export ENABLE_COC="no" # yes | no
export USE_WANDB="no" # yes | no
export WANDB_API_KEY="..." # only if USE_WANDB=yes
export WANDB_TEAM="..." # only if USE_WANDB=yes
export WANDB_PROJECT="..." # only if USE_WANDB=yes
export STAGES="both" # stage1 | stage2 | both | eval
export PAI_DIR="/path/to/pai_dataset"
export CKPT_DIR="/path/to/Alpamayo-R1-10B"
export STAGE1_CKPT="" # set if STAGES in {stage2, eval}
export STAGE2_CKPT="" # set if STAGES = eval

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

PAI clip ─► PAIDataset ─► vla_processor ─► collate_fn
│
▼
Alpamayo-R1-10B ckpt ─► Stage 1: TrainableReasoningVLA ──► output_stage1/checkpoint-XXXX
(VLM + trajectory tokenizer; full VLM trainable,
visual subnet at 0.1× LR, ZeRO-2, grad-ckpt)
│
▼
Stage 2: TrainableAlpamayoR1 ──► output_stage2/checkpoint-XXXX
(Stage-1 VLM **frozen**, action expert trained;
no DeepSpeed, no grad-ckpt, DDP with
`find_unused_parameters=True`)
│
▼
evaluate_hf.py → val/metric/min_ade, ade, corner_distance

Key facts an agent must internalise before running anything:

  • Same entry point both stages. alpamayo1_sft.train_hf reads

--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.

bash
# 1) Install uv (skip if already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
# 2) Clone (or `cd` into an existing clone) and provision the venv
export YOUR_HOME="/path/to/your/workspace"
git clone https://github.com/NVlabs/alpamayo-recipes.git "$YOUR_HOME/alpamayo-recipes"
cd "$YOUR_HOME/alpamayo-recipes/recipes/alpamayo1_sft"
uv venv a1_sft # if `a1_sft/` already exists, skip this line
source a1_sft/bin/activate
uv sync --active
Non-interactive harnesses (agents, CI, `bash -c "..."` per step): the
export PATH=... above only persists for the current shell. Either
append the line to ~/.bashrc once, or re-export it at the top of every
non-interactive shell that calls uv. Forgetting this is the most common
reason a subsequent step reports uv: command not found.

What uv sync resolves:

  • alpamayo_r1 from

`github.com/NVlabs/alpamayo` (see pyproject.toml:51-53).

  • alpamayo-recipes editable 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):

bash
python -c "from alpamayo.processor.qwen_processor import \
get_preprocess_data_fn_from_model_config, collate_fn_from_model_config; print('ok')"
python -c "from alpamayo.data.pai import PAIDataset; print('ok')"

Dataset & checkpoint

PAI dataset

Use `$CHUNK_RANGE` from the user's answers (see Inputs).

bash
export HF_TOKEN=<your HuggingFace token>
cd "$YOUR_HOME/alpamayo-recipes"
python scripts/download_pai.py \
--chunk-ids "$CHUNK_RANGE" \
--camera camera_front_wide_120fov camera_cross_left_120fov \
camera_cross_right_120fov camera_front_tele_30fov \
--calibration camera_intrinsics sensor_extrinsics \
--labels egomotion \
--output-dir "$PAI_DIR"

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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/nvlabs/alpamayo-recipes/alpamayo1-sft/badge)](https://verified-skill.com/skills/nvlabs/alpamayo-recipes/alpamayo1-sft)

Something wrong with this skill or its page? Tell us.