xsponenta Claude Opus 4.7 commited on
Commit ·
bd280f7
1
Parent(s): b6bc99a
Revert TTA: 3x inference timed out on HF Space (b6bc99a -> all zeros)
Browse filesSet USE_TTA=False. The TTA strict variant locally showed +0.003 mean and
+0.029 q5, but the 3x inference cost exceeded HF Space's evaluation time
limit, returning 0.0 for every sample. Pipeline now runs the single-seed
fast path it used in 2df06c6 (the proven 0.4815 leaderboard config).
Also leaves USE_ENSEMBLE=False with infrastructure preserved: a fine-tune
attempt with heavy augmentation (jitter 0.01 + drop 0.1) produced a model
0.040 hss_mean WORSE than the original on local 50-sample A/B, so the
ensemble code in script.py + ensemble.py + tta.py is wired but disabled
pending a better-trained 2nd checkpoint.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
58 unmodified lines5960616263646566676869707172307 unmodified lines38038138238338438524 unmodified lines41041141241341441541658 unmodified linesMERGE_THRESH = 0.4SNAP_RADIUS = 0.5# Test-time augmentation: 3 priority-sample seeds + Hungarian matching with# strict 3-pass agreement (min_passes_for_keep=2). Local 100-sample A/B:# q5 0.062 -> 0.091 (+47%), mean +0.003. Costs 3x inference time but# strict filter dramatically improves precision on hard scenes.USE_TTA = TrueTTA_SEEDS = (2718, 31415, 42)TTA_MIN_PASSES = 2def fuse_and_sample(sample, cfg, rng):"""Run point fusion + priority sampling on a raw dataset sample.307 unmodified linesmodel = load_model(checkpoint_path, device)print(f"Model loaded: {sum(p.numel() for p in model.parameters()):,} params")# Point fusion configcfg = FuserConfig()rng = np.random.RandomState(2718)24 unmodified linespred_status = "ok"n_fused_pts = 0if USE_TTA:# Multi-seed TTA: fuse + predict 3 times, Hungarian-match segments# across passes, drop those without min_passes agreement.try:58 unmodified lines59606162636465666768697071727374757677787980818283307 unmodified lines39139239339439539639739839940040140240340440540640724 unmodified lines43243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447558 unmodified linesMERGE_THRESH = 0.4SNAP_RADIUS = 0.5# Test-time augmentation: 3 priority-sample seeds + Hungarian matching.# Local 100-sample A/B was +0.003 mean / +0.029 q5 vs single-pass, BUT the# 3x inference cost (commit b6bc99a) timed out on HF Space and produced# all-zero scores. Disabled. Re-enable only with single-seed (2x not 3x)# or after profiling shows the HF Space can fit 3x within its time limit.USE_TTA = FalseTTA_SEEDS = (2718, 31415, 42)TTA_MIN_PASSES = 2# Multi-checkpoint ensemble: tried 2026-05-23 with checkpoint2.pt fine-tuned# under heavy aug (jitter 0.01 + drop 0.1) for 20k steps from checkpoint.pt.# Local 50-sample A/B (new model alone vs original alone): mean dropped by# 0.040 with 20 big losses vs 5 big wins -- the aug degraded model accuracy.# Ensemble of [original + new] therefore can't improve over original alone.# Keep flag disabled; need a more careful training run before re-enabling.USE_ENSEMBLE = FalseENSEMBLE_MIN_PASSES = 1TTA_PLUS_ENSEMBLE_MIN_PASSES = 2def fuse_and_sample(sample, cfg, rng):"""Run point fusion + priority sampling on a raw dataset sample.307 unmodified linesmodel = load_model(checkpoint_path, device)print(f"Model loaded: {sum(p.numel() for p in model.parameters()):,} params")# Optional: load 2nd checkpoint for ensemble inferenceensemble_models = Noneif USE_ENSEMBLE:checkpoint2_path = SCRIPT_DIR / "checkpoint2.pt"if checkpoint2_path.exists() and checkpoint2_path.stat().st_size > 1000:model2 = load_model(checkpoint2_path, device)ensemble_models = [model, model2]print(f"Ensemble: loaded 2 models for cross-checkpoint averaging")else:print(f"USE_ENSEMBLE=True but checkpoint2.pt not present; running single-model")# Point fusion configcfg = FuserConfig()rng = np.random.RandomState(2718)24 unmodified linespred_status = "ok"n_fused_pts = 0if ensemble_models is not None and USE_TTA:# 2-model ensemble × multi-seed TTA: 2 * len(seeds) total passes.# Strict cross-pass agreement filters spurious segments.try:from ensemble import predict_sample_ensemblepred_v, pred_e = predict_sample_ensemble(sample, cfg, ensemble_models, device,seeds=TTA_SEEDS,min_passes_for_keep=TTA_PLUS_ENSEMBLE_MIN_PASSES,)if torch.cuda.is_available():torch.cuda.empty_cache()except Exception as e:import tracebackprint(f" Ensemble+TTA failed for {order_id}:\n{traceback.format_exc()}")pred_v, pred_e = empty_solution()pred_status = "ensemble_tta_failed"if torch.cuda.is_available():torch.cuda.empty_cache()elif ensemble_models is not None:# 2-model ensemble, single seedtry:from ensemble import predict_sample_ensemblepred_v, pred_e = predict_sample_ensemble(sample, cfg, ensemble_models, device,seeds=(2718,),min_passes_for_keep=ENSEMBLE_MIN_PASSES,)if torch.cuda.is_available():torch.cuda.empty_cache()except Exception as e:import tracebackprint(f" Ensemble failed for {order_id}:\n{traceback.format_exc()}")pred_v, pred_e = empty_solution()pred_status = "ensemble_failed"if torch.cuda.is_available():torch.cuda.empty_cache()elif USE_TTA:# Multi-seed TTA: fuse + predict 3 times, Hungarian-match segments# across passes, drop those without min_passes agreement.try:
script.py+65-6