playful / chess-sim /code /sim /train_policy.sh
Ali-Uraish's picture
code: pipeline check, set_norm_stats, explicit optimizer hook
6145c8e verified
Raw History Blame Contribute Delete
1.95 kB
#!/bin/bash
# Fine-tune SmolVLA (lerobot/smolvla_base) on the phase 2 sim dataset, overhead and wrist
# cameras only, and push the result to the Hugging Face Hub.
#
# The base model was pretrained with cameras named camera1..camera3; the rename map
# feeds our overhead view as camera1 and the wrist view as camera2 (camera3 unused).
# Starts from the base model unless BASE names a checkpoint to continue from (for example the
# baseline, to fine-tune it on correction demonstrations).
# Run from the project root on the GPU pod, after sim/make_train_view.py:
# STEPS=20000 bash sim/train_policy.sh
# Baseline (overhead and wrist only already, no train view needed):
# ROOT=data/so101_chess_baseline REPO=Machanize/chess_phase_smolvla_baseline \
# JOB=chess_phase_smolvla_baseline STEPS=10000 bash sim/train_policy.sh
# EXTRA_ARGS adds lerobot-train options (for example --policy.optimizer_lr=0.0).
# Note: when BASE is a trained checkpoint, lerobot-train replaces its saved state/action
# normalization with the statistics of the dataset at ROOT (lerobot_train.py, overrides).
set -euo pipefail
cd "$(dirname "$0")/.."
ROOT=${ROOT:-data/so101_chess_sim_train}
REPO=${REPO:-Machanize/chess_phase_smolvla}
.venv/bin/lerobot-train \
--policy.path="${BASE:-lerobot/smolvla_base}" \
--dataset.repo_id="${DATASET_ID:-local/so101_chess_sim_train}" \
--dataset.root="$ROOT" \
--rename_map='{"observation.images.overhead": "observation.images.camera1", "observation.images.wrist": "observation.images.camera2"}' \
--batch_size="${BATCH:-64}" \
--steps="${STEPS:-20000}" \
--save_freq="${SAVE_FREQ:-5000}" \
--log_freq=100 \
--num_workers="${WORKERS:-24}" \
--output_dir="${OUT:-outputs/${JOB:-chess_phase_smolvla}}" \
--job_name="${JOB:-chess_phase_smolvla}" \
--policy.device=cuda \
--wandb.enable=false \
--policy.push_to_hub="${PUSH:-true}" \
--policy.repo_id="$REPO" \
--policy.private=false \
${EXTRA_ARGS:-}