# SO-101 Stage 2 (BIEC Real-Arm) — Corrected Master Handoff & Packaging Playbook ## 1. Zero-Shot Baseline First (Before Recording Real Demos) 1. **Upload Primary Baseline Zip to `https://academy.nwaves.ai/policies`**: - **#1 Primary (`10k` steps)**: **`so101_stage2_act_010000.zip`** (`loss=0.038`, 50-step avg `0.0530`, `grdn=1.704`, `53.2` epochs, `model.safetensors` SHA256: `7b96e534bda1b713982b3cd006e45cb3481eb60c6a8e0c0631550445474d5f1b`) - **#2 Backup (`5k` steps)**: **`so101_stage2_act_005000.zip`** (`loss=0.069`, 50-step avg `0.0664`, `grdn=3.505`, `27.9` epochs, `model.safetensors` SHA256: `213e2eb471c6f6ab9c0020ab7a28a0565c1a3128032ac13886c4aabdb078d758` — lighter UVC augmentation fallback) 2. **Pre-Flight Camera & Mount Check**: - Verify in the live feed that **overhead (`scene`)** and **wrist (`wrist`)** USB cameras are **NOT swapped** in `v4l2`/device order. - **Tape down the overhead camera mount and table edges BEFORE recording Demo 1** so camera extrinsics never drift between teleop and evaluation. --- ## 2. 100% Real Teleop Warm-Start (NO 50/50 Sim Co-Training) - **Dataset Collection**: Record **30–50 smooth, decisive real-arm teleop demos** (`ppprock11/so101_real_biec`). Delete any fumbled/stalled episodes immediately, and systematically vary **both cube spawn positions AND moved tray locations** across the workspace. - **Why 100% Real Only (No Sim Mixing)**: Fine-tuning on 100% real data lets `lerobot==0.4.4` recompute the exact real-arm joint state/action mean & std normalizers and real UVC camera photometry without pulling trajectories back toward simulated physics/lighting. - **Step Budget & Compute**: - **35–50 clean real demos**: train **`5,000` steps** (`batch_size=16`, `lr=1e-5`). - **~20 clean real demos**: train **`2,500` steps** (`batch_size=16`, `lr=1e-5`) to prevent memorization. - Run on the **NWaves Lab GPU** or a **Vast.ai / Brev RTX 4090** (`~10–12 mins` total; skip slow E2E T4s). ```bash # 1. Pull unpacked 10k base checkpoint & packaging script from Hugging Face mkdir -p ~/workspace/stage2_base hf download cspaliwal/so101-stage2-deploy \ --include "so101_stage2_act_010000/*" "pack_stage2_real.py" "inference.json" "policy.py" \ --local-dir ~/workspace/stage2_base BASE_CKPT=~/workspace/stage2_base/so101_stage2_act_010000 # 2. Warm-start ACT on 100% real teleop data (5000 steps for 35-50 demos, 2500 steps for ~20 demos) lerobot-train \ --policy.path="$BASE_CKPT" \ --policy.device=cuda \ --policy.push_to_hub=false \ --policy.optimizer_lr=1e-5 \ --policy.optimizer_lr_backbone=1e-5 \ --dataset.repo_id=ppprock11/so101_real_biec \ --dataset.root=~/workspace/datasets/so101_real_biec \ --dataset.image_transforms.enable=true \ --batch_size=16 \ --steps=5000 \ --save_freq=2500 \ --log_freq=50 \ --eval_freq=0 \ --num_workers=4 \ --output_dir=~/workspace/outputs/stage2_real_warmstart \ --job_name=so101_stage2_real_warmstart ``` --- ## 3. Full Checkpoint Packaging Rule (CRITICAL — Never Swap `model.safetensors` Alone) > **WARNING:** NEVER copy `model.safetensors` into an old folder by itself. `lerobot==0.4.4` bakes the dataset's joint/action normalization statistics into `policy_preprocessor_step_3_normalizer_processor.safetensors` and `policy_postprocessor_step_0_unnormalizer_processor.safetensors`. Mixing new weights with old sim normalizer stats corrupts every joint target on the real arm. Always package **all 6 trained runtime files together** from `checkpoints/last/pretrained_model` (or `checkpoints/002500/pretrained_model`) using `pack_stage2_real.py`: - `model.safetensors` (new weights) - `config.json` (with `"pretrained_path": null` scrubbed) - `policy_preprocessor.json` + `policy_preprocessor_step_3_normalizer_processor.safetensors` (new real state stats) - `policy_postprocessor.json` + `policy_postprocessor_step_0_unnormalizer_processor.safetensors` (new real action stats) - Plus `policy.py` (`ACCEPTED = ("act",)`, `cuda -> mps -> cpu`) and `inference.json` (`n_action_steps=25`, `gripper_min=6.0`, `gripper_max=58.0`, `snap_gripper=false`), while **stripping `train_config.json` and optimizer state**. ```bash python3 ~/workspace/stage2_base/pack_stage2_real.py \ --ckpt_dir ~/workspace/outputs/stage2_real_warmstart/checkpoints/last/pretrained_model \ --template_dir "$BASE_CKPT" \ --out_zip ~/workspace/so101_stage2_real_5k.zip ``` --- ## 4. Safe Physical Gripper & Chunk Tuning (`inference.json`) ```json { "n_action_steps": 25, "gripper_min": 6.0, "gripper_max": 58.0, "snap_gripper": false } ``` - **NEVER set `"snap_gripper": true` on physical Feetech STS3215 servos**: Hard binary snapping causes current-overload stalls on the physical jaw gears and knocks the cube out of alignment. Keep `"snap_gripper": false`. - **If gripper release is too tight over the tray**: Raise `"gripper_max"` from `58.0` to **`68.0`** (`--gripper_max 68.0` in `pack_stage2_real.py`). - **If descent/grasp reacts too slowly**: Lower `"n_action_steps"` from `25` (`833 ms`) to **`15`** (`500 ms`, `--n_action_steps 15` in `pack_stage2_real.py`).