jgrusewski
0fced7619d
fix(ml): Add max_validation_batches to prevent validation OOM
Workaround for Candle's lack of CUDA memory clearing APIs
Problem:
- Validation needs 1760MB for 176 batches
- Only 2485MB available after training
- Candle doesn't expose cuda::empty_cache() to free optimizer memory
- Result: OOM during validation despite optimizer drop
Solution:
- Add max_validation_batches parameter to limit validation batches
- Default: None (unlimited, backward compatible)
- Recommended for 4GB GPUs: 50 batches (~500MB vs 1760MB)
Changes:
1. CLI parameter: --max-validation-batches <num>
2. TFTTrainerConfig: max_validation_batches field
3. TFTTrainingConfig: max_validation_batches field
4. Validation loop: .take(max_batches) to limit batches
5. Updated: benchmarks, legacy binary for compatibility
Impact:
- 50 batches: 1611MB + 500MB = 2111MB < 2485MB ✅
- 176 batches: 1611MB + 1760MB = 3371MB > 2485MB ❌
- Memory savings: 1260MB (72% reduction)
- Trade-off: Validates on subset (28% of data)
Files Modified:
- ml/examples/train_tft_parquet.rs (CLI + config)
- ml/src/trainers/tft.rs (config + validation loop)
- ml/src/tft/training.rs (internal config)
- ml/src/benchmark/tft_benchmark.rs (compatibility)
- ml/src/bin/train_tft.rs (compatibility)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 20:58:49 +01:00
..
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-22 20:50:43 +02:00
2025-10-25 15:36:57 +02:00
2025-10-19 09:10:55 +02:00
2025-10-22 20:50:43 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-21 08:54:26 +02:00
2025-10-21 08:54:26 +02:00
2025-10-22 20:50:43 +02:00
2025-10-19 09:10:55 +02:00
2025-10-03 07:34:26 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-14 10:42:56 +02:00
2025-10-23 09:16:58 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-22 20:50:43 +02:00
2025-10-22 20:50:43 +02:00
2025-10-22 20:50:43 +02:00
2025-10-22 20:50:43 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-22 20:50:43 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-22 20:50:43 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-22 20:50:43 +02:00
2025-10-19 09:10:55 +02:00
2025-10-23 10:43:52 +02:00
2025-10-19 09:10:55 +02:00
2025-10-21 08:54:26 +02:00
2025-10-22 20:50:43 +02:00
2025-10-22 20:50:43 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-25 23:19:40 +02:00
2025-10-19 09:10:55 +02:00
2025-10-21 08:54:26 +02:00
2025-10-25 15:36:57 +02:00
2025-10-19 09:10:55 +02:00
2025-10-25 15:36:57 +02:00
2025-10-19 09:10:55 +02:00
2025-10-22 20:50:43 +02:00
2025-10-26 11:14:33 +01:00
2025-10-21 21:13:11 +02:00
2025-10-26 20:58:49 +01:00
2025-10-21 21:13:11 +02:00
2025-10-21 21:13:11 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-21 08:54:26 +02:00
2025-10-20 21:54:39 +02:00
2025-10-19 09:10:55 +02:00
2025-10-21 08:54:26 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-21 08:54:26 +02:00
2025-10-21 08:54:26 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-22 20:50:43 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-22 20:50:43 +02:00
2025-10-19 09:10:55 +02:00
2025-10-20 21:54:39 +02:00
2025-10-20 21:54:39 +02:00
2025-10-20 21:54:39 +02:00
2025-10-19 09:10:55 +02:00
2025-10-19 09:10:55 +02:00
2025-10-20 21:54:39 +02:00
2025-10-20 21:54:39 +02:00
2025-10-20 21:54:39 +02:00
2025-10-20 21:54:39 +02:00
2025-10-20 21:54:39 +02:00