# PoP pretraining on community SO-100 data Pretrains PoP's vision trunk and control head (DINOv2 ViT-S/14 + adaLN transformer head, 27.74M parameters) on `HuggingFaceVLA/community_dataset_v2` at revision `815dd11`, end to end on one SLURM node: download, filter and standardize, train. The policy gets two camera views and the 6 joint values and predicts 16-step chunks of the 6 joint targets. It receives no language and no referent: PoP's referent slots hold their learned null vectors and the skill code is a reserved "unspecified" entry. The data has RGB only (no depth, no camera calibration), so the referent (form B, a 2D point and its offset from the projected gripper) is added at fine-tuning on the target robot. ## Run ```bash unzip pop_pretrain.zip && cd pop_pretrain nano config.env # POPT_WORK (~0.8 TB, or ~0.55 TB with --delete-raw), SBATCH_*_ARGS, HF_TOKEN bash setup_env.sh # once, on a node with internet (see Environment) srun --gres=gpu:2 --cpus-per-task=16 --mem=64G --time=01:00:00 bash smoke_test.sh # optional, ~10 min bash run_all.sh # submits download -> preprocess (array) -> index -> train ``` If compute nodes have no internet: `bash slurm/1_download.sbatch` on a login node, then `SKIP_DOWNLOAD=1 bash run_all.sh`. Training stops cleanly after `STOP_AFTER_HOURS` and resubmits itself until done; rerunning any step resumes it. ## Environment (uv) `setup_env.sh` installs uv 0.11.19 into `$POPT_WORK/uv/bin` (shell startup files are not changed), then `uv sync --frozen` installs a uv-managed CPython 3.10 (`.python-version`) and the exact packages in `uv.lock` (torch 2.5.1 with CUDA 12.4, numpy 1.26.4, pyarrow 18.1.0, av 15.1.0, huggingface_hub 2.4.0) into `$POPT_WORK/venv`. uv's cache and Python live in `$POPT_WORK/uv`, so nothing goes to the home quota. Every step runs as `uv run --no-sync ...`, which uses that environment as it is and needs no network. To change a dependency: edit `pyproject.toml`, run `uv lock`, then `bash setup_env.sh`. | Step | Script | Resources (defaults in `slurm/`) | Output in `$POPT_WORK` | |---|---|---|---| | 1 download | `scripts/download.py` | 8 CPUs, internet | `raw/` (~265 GB), `selection.json`, `weights/dinov2_vits14_pretrain.pth` (sha256 checked) | | 2 preprocess | `scripts/preprocess.py` | array of `PREP_TASKS` x 16 CPUs | `shards//` (~0.3 MB per frame, ~0.5 TB in all), `shards/_status/` for dropped or failed datasets | | 3 index | `scripts/build_index.py` | 2 CPUs | `shards/index.json`, `shards/report.json` (what was kept and dropped, and why) | | 4 train | `scripts/train.py` via `torchrun` | 1 node, 2 GPUs, 32 CPUs, 128 GB | `runs/$RUN_ID/` (`train.log`, `config.json`, `ckpt/step_*.pt`, `ckpt/resume.pt`) | Training reads about 0.3 MB per sample at random from `shards/`; put `POPT_WORK` on node-local NVMe or a fast parallel file system. `raw/` can be deleted after step 3. With less than ~0.8 TB free, run step 2 with `PREPROCESS_ARGS=--delete-raw`: each dataset's `data/` and `videos/` are deleted from `raw/` as soon as its shard is written or it is dropped (`meta/` is kept; failed datasets keep their files), so the peak is about the size of `shards/`. Step 1 skips datasets whose shard is finished, so re-running it does not download them again. ## What step 2 keeps Details and thresholds: docstring of `scripts/preprocess.py`; counts land in `shards/report.json`. - Datasets: SO-100/101 single arm with the standard 6 joints (two-arm, 7-joint and unnamed-joint datasets are dropped), RGB video present, source rate at or above `TARGET_FPS`. - Episodes dropped for: NaN/inf, broken or gapped timestamps, shorter than 2 s or longer than 10 min, an arm that barely moves (static), single-step joint jumps (glitches, wrap-around), unreadable or misaligned video. - Resampled to 10 Hz; images resized to 256 x 256 (aspect ratio not kept: apply the same resize on the target robot). - Cameras: slot `image` is the third-person view. The wrist view is the first later slot whose pixels are almost never still (contributors' camera names are unreliable and not used). No wrist camera: the wrist input is masked. A dataset whose only camera is a wrist camera is dropped. - Normalization per dataset (mean/std, std floored): state, and actions relative to the current joint state (`--action-mode delta`, default) or absolute (`abs`). Statistics are saved in every checkpoint. ## Model and recipe PoP's network (same parameter names as `pop/model/policy.py`, so a checkpoint loads into the fine-tuning model by name): trunk 22.06M (fine-tuned at lr 3e-5), head 5.68M (lr 3e-4), AdamW (0.9, 0.95), weight decay 0.05, 2k warmup then cosine to 10%, EMA 0.9995, bf16, agent-view crop 0.8, L1 on 16-action chunks. Length: 200k steps at a global batch of 256 (51.2M samples, SmolVLA's pretraining budget). Change with `TRAIN_ARGS="--steps ... --batch ..."`. Checkpoint `ckpt/step_XXXXXX.pt`: `ema` (weights), `config`, `norm_stats` (per dataset), `action_mode`, `step`. At fine-tuning, `referent.enc`, `referent.role` and the five real skill rows start untrained; `skill.weight` has 6 rows here (row 5 = unspecified) against PoP's 5. ## Checked before delivery (2026-11-18, PoP code base `pretrain` branch) - The vendored DINOv2 (`third_party/dinov2`, Apache-2.0) gives the same patch tokens as the torch.hub copy PoP uses (max difference 0.0). - Steps 1-3 on 23 datasets; step 4 with 2 processes on CPU (gloo) including resume, and on 2 GPUs (NCCL) including the time-limit stop. - Camera roles checked by eye on 31 two-camera datasets, all right: 21 used to set the thresholds, then 10 drawn at random. Second-slot still fraction 0.00-0.08 for the 14 wrist cameras, 0.28-0.81 for the 17 fixed views. ## Fine-tuning and roll-out on the SO-101 - `scripts/convert_v3.py` (LeRobot v3.0 datasets to shards), `scripts/fit_camera.py` (fixed camera from the arm's silhouette and the URDF), `scripts/label_events.py` (referent labels from gripper events; rules for the four `tmhoanggg` tasks), `scripts/finetune.py` (one joint policy, PoP or sentence baseline). Each header gives its command. - `scripts/rollout.py` runs a fine-tuned checkpoint on an SO-101 follower through LeRobot 0.7.0, in its own environment (Python 3.12: `uv pip install "lerobot[feetech]==0.7.0"`). `popt/runtime.py` holds the policy wrapper and the step tracker; `scripts/check_runtime.py` checks both against training on recorded episodes. `assets/` holds the URDF and the T5 config the roll-out reads (sources in `assets/SOURCE.txt`).