#!/usr/bin/env bash # v31 training — raw DINOv2-ViTS/14 teacher (replaces MDGT) # # Goal: Benchmark DINOv2 raw as teacher for L_mat. # - DINOv2-ViTS/14 is public (Meta, ICLR 2024), cite-able, fully reproducible # - Replaces unpublished MDGT checkpoint → paper can be submitted without IP issues # - Expected Pearson ~0.55–0.70 (vs 0.80 with MDGT) — establish baseline # # Key change vs v29: # --teacher dinov2_raw : frozen DINOv2-ViTS/14 CLS token [B,384] as L_mat teacher # (v29 used --no-mat entirely; v31 restores L_mat with public teacher) # remove --no-mat : L_mat is re-enabled # --no-mat-stats : raw cosine targets (no per-identity tanh stats) — v14 behaviour # avoids FVC/SD302 asymmetry that caused collapse in v16/v17 # --proto-max-batches 0: full dataset prototypes (avoid sensor-biased partial prototypes) # # Inherited from v29 (validated): # --spread-weight 4.0 # --concept-deg-gamma 2.0 # --ortho-weight 3.0 # --k-cross 0 # --deg-every-n-steps 2 # # Expected dynamics: # S1 (ep 0-9): q_std rises 0→15+; l_mat decreases (DINOv2 cosine varies with quality) # S2 (ep 20+): l_pair decreases; l_mat converging; q_std stable 15–22 # Target: KS ≤ 0.20, Pearson ≥ 0.55, q_std ≥ 15 set -euo pipefail REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" export PATH="/home/aiserver/miniconda3/bin:$PATH" VERSION="v31" SAVE_DIR="${REPO_ROOT}/sifq/checkpoints/${VERSION}" LOG_FILE="${REPO_ROOT}/sifq/logs/train_${VERSION}.log" EVAL_SCRIPT="${REPO_ROOT}/sifq/scripts/run_eval_${VERSION}.sh" mkdir -p "${REPO_ROOT}/sifq/logs" python "${REPO_ROOT}/sifq/scripts/train_sifq.py" \ --root-302a "${REPO_ROOT}/dataset/nist302a/images/challengers" \ --root-302b "${REPO_ROOT}/dataset/302b/images/baseline" \ --root-302d "${REPO_ROOT}/dataset/nist_302d/images/auxiliary" \ --root-fvc2002 "${REPO_ROOT}/dataset/FVC_Dataset/FVC2002" \ --root-fvc2004 "${REPO_ROOT}/dataset/FVC_Dataset/FVC2004" \ --root-polyu "${REPO_ROOT}/dataset/PolyU" \ --exclude-sensor "R_1000_slap,R_500_slap,S_500_slap" \ --teacher dinov2_raw \ --dinov2-model dinov2_vits14 \ --no-mat-stats \ --proto-max-batches 0 \ --epochs 60 \ --batch-size 96 \ --image-size 224 \ --lr 1e-4 \ --spread-mode uniform \ --spread-weight 4.0 \ --concept-deg-gamma 2.0 \ --sd302-concept-weight 0.0 \ --deg-every-n-steps 2 \ --k-cross 0 \ --max-train-samples -1 \ --num-workers 8 \ --gpus 0 \ --save-dir "${SAVE_DIR}" \ --wandb \ --wandb-offline \ --wandb-project "sifq" \ --wandb-run-name "${VERSION}" \ 2>&1 | tee "${LOG_FILE}" echo "[auto-eval] Training done. Starting eval ${VERSION}..." bash "${EVAL_SCRIPT}" >> "${LOG_FILE}" 2>&1 # ── Compact epoch log ────────────────────────────────────────────────────── EPOCH_LOG="${REPO_ROOT}/sifq/logs/train_${VERSION}_epochs.log" { grep -E "^(Device:|SD302|FVC|PolyU|Excluded|AMP|Sensor|Stage|Pre-cach|Teacher)" "${LOG_FILE}" | head -10 echo "---" grep "^Epoch" "${LOG_FILE}" } > "${EPOCH_LOG}" 2>/dev/null || true echo "[done] Compact epoch log: ${EPOCH_LOG}"