Skip to main content

TASK - Training (PCMA Stage 1 + Stage 2)

Objective: produce checkpoints/stage1/ and checkpoints/stage2/ (or checkpoints/final/) from the paper's PCMA curriculum. Code: training/, configs: configs/, entry: scripts/train_stage*.sh.

Prerequisites​

  • Env ready: bash scripts/setup.sh && bash scripts/verify_environment.sh
  • Weights cached: bash scripts/download_models.sh (~1.6GB, foundation only - no official Earth-OneVision weights exist, docs/assumptions.md #A11)
  • India/full manifests built (see data-subset runbook): one JSONL per stage
  • Disk: checkpoints are full state dicts + optimizer.pt/scheduler.pt every 500 steps (training/trainer.py) - keep 50GB+ free

Config (do not edit code for these)​

KnobStage 1 fileStage 2 filePaper value
LRconfigs/stage1.yaml (2e-5)configs/stage2.yaml (5e-6)explicit
Epochs44explicit
Batch/GPU, grad-accumbatch_size_per_gpu, gradient_accumulation_stepssameeff. batch 32 on 8×H100; single-device uses accum as stand-in
Seq len, opt, schedconfigs/base.yaml (5400, AdamW wd=0.05, cosine warmup 0.03)-explicit

Steps​

  1. Build + validate manifests:
python tools/convert_dataset.py --dataset cdvqa --split train
python tools/validate_dataset.py --manifest data/manifests/cdvqa/train.jsonl --intended-use train
cat data/manifests/*/train.jsonl > data/manifests/stage1_train.jsonl # train.py takes ONE manifest
  1. Dry-run the loop (minutes, catches 90% of failures): bash scripts/smoke_test.sh - all 12 steps must pass.
  2. Stage 1 (Apple Silicon):
MANIFEST=data/manifests/stage1_train.jsonl IMAGES_ROOT=data/converted bash scripts/train_stage1.sh
  1. Stage 2 (same, with optical replay baked into its manifest): bash scripts/train_stage2.sh
  2. CUDA multi-GPU instead:
deepspeed --num_gpus=8 training/train.py --config configs/stage1.yaml \
--deepspeed configs/deepspeed_zero2.json \
--manifest data/manifests/stage1_train.jsonl --images_root data/converted

Done criteria​

  • checkpoints/stage{1,2}/final/ contain model.pt, tokenizer/, and earth_onevision_metadata.json (training/checkpointing.py)
  • Loss decreases across epochs; no NotImplementedError from MPS (vision tower stays on CPU by design, docs/assumptions.md #A13)
  • Checkpoint reloads: load_checkpoint refuses anything not labeled earth_onevision_reproduction_checkpoint - expected

Debug​

SymptomCause → fix
OOM on MPSlower batch_size_per_gpu to 1, raise gradient_accumulation_steps; reduce vision.max_patches in configs/base.yaml
aten::_upsample_bilinear2d_aa NotImplementedErrorvision tower must stay CPU-pinned (model/earth_onevision.py:to) - don't "fix" by moving it to MPS
GQA mps_matmul crash in generateattn_implementation: eager on MPS is the workaround, not a bug
Train manifest rejectedrun tools/validate_dataset.py --intended-use train - test/val leakage fails the build by design