--- library_name: pytorch pipeline_tag: reinforcement-learning tags: - reinforcement-learning - robotics - sim-to-real - qt-opt - dinov2 - mujoco --- # BallBalanceRL checkpoints Every checkpoint from [BallBalanceRL](https://github.com/arush-garg/BallBalanceRL): a camera-only QT-Opt policy that balances a ball on a servo-tilted beam, trained in MuJoCo and run on real hardware (MG90S servo, Logitech C270). The folder layout mirrors the code repo, so a download drops each file exactly where the scripts expect it. ## Which checkpoint to use | Path | What it is | |---|---| | `scratchpad/ft_probe/v2_anchor4/checkpoint_v7_bginv.pt` | **Best on hardware.** v7's critic with a background-invariance-distilled encoder. Balanced the real ball for the full 300 steps (15 s) in 2 of 4 runs. | | `runs/qt_opt_mg90_v7_scratch_lim10/checkpoint_step110000.pt` | v7: plain-wall RL baseline on the corrected MG90S plant (±10° action limit). Parent of the distilled checkpoint. | | `runs/qt_opt_mg90_v8_bgrand_scratch/checkpoint_step{50000,60000}.pt` | v8: v7's recipe plus procedural backgrounds. Better than v7 in sim, worse on hardware. | ## Everything else - `runs/qt_opt_mg90_v7_*`, `runs/qt_opt_mg90_v8_*`: corrected-plant runs (fine-tune, scratch, mirror augmentation, background randomization, online RL fine-tune probe). `checkpoint_step.pt` are immutable snapshots. - `runs/qt_opt_mi300x_v5_*`, `runs/qt_opt_mi300x_v6_*`: AMD MI300X runs on the earlier (numerically unstable) actuator: v5 baseline and the v6 anti-jerk penalty sweep. The 3.4-4.9 GB files hold the replay buffer, so training can be resumed from them. - `runs/qt_opt_mps_*`: first QT-Opt runs on a MacBook (MPS), on the earlier actuator. - `runs/smoke_fastsam`, `runs/dinov2s_mps_2k.log`: legacy SAC / FastSAM experiments. - `scratchpad/ft_probe/`: encoder distillation probes (v1, v2 with plain-frame anchor x4, v3 with pixel noise) and their real-frame fragility reports. Each run folder also has its training log and evaluation outputs. Checkpoints trained on the earlier actuator score ~0% on the corrected plant and on hardware; they are kept for the record. ## Download ```bash # one checkpoint, into the matching repo path hf download Techno03/BallBalanceRL scratchpad/ft_probe/v2_anchor4/checkpoint_v7_bginv.pt --local-dir . # a whole run hf download Techno03/BallBalanceRL --include "runs/qt_opt_mg90_v7_scratch_lim10/*" --local-dir . ``` ## Load Each file is a `torch.save` dict: `encoder_state_dict`, `head_state_dict` (critic ensemble), their target copies, `optimizer_state_dict`, `args` (training flags), `step`, `arch_tag`, `action_limit_rad`. The checkpoints under 2 GB load with `torch.load(path, weights_only=True)`. The DINOv2-small backbone is not stored; it comes from `facebook/dinov2-small`. ```bash python scripts/run_real_qtopt.py --checkpoint scratchpad/ft_probe/v2_anchor4/checkpoint_v7_bginv.pt \ --robot tilt_track --port /dev/cu.usbmodem1101 --device mps --freq 20 --camera 0 --max-command-deg 20 python scripts/evaluate_qt_opt.py --checkpoint runs/qt_opt_mg90_v7_scratch_lim10/checkpoint_step110000.pt --episodes 20 --device mps ```