From 5836280a34bdbe5f620f22582bf736417381f596 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Fri, 17 Apr 2026 09:35:16 +0200 Subject: [PATCH] =?UTF-8?q?cleanup:=20remove=20AutoBatchSizer=20=E2=80=94?= =?UTF-8?q?=20batch=5Fsize=20from=20config=20is=20source=20of=20truth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AutoBatchSizer didn't account for experience collector VRAM, causing OOM on H100 with state_dim=96. batch_size is configured per GPU profile (h100.toml=8192, rtx3050.toml=64). No auto-sizing needed. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/trainers/dqn/trainer/constructor.rs | 40 ++----------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/crates/ml/src/trainers/dqn/trainer/constructor.rs b/crates/ml/src/trainers/dqn/trainer/constructor.rs index c4e4abe87..1d75b1337 100644 --- a/crates/ml/src/trainers/dqn/trainer/constructor.rs +++ b/crates/ml/src/trainers/dqn/trainer/constructor.rs @@ -23,7 +23,6 @@ use crate::dqn::regime_conditional::RegimeConditionalDQN; use crate::dqn::reward::{RewardConfig, RewardFunction}; use crate::features::microstructure_features::*; use crate::labeling::triple_barrier::TripleBarrierEngine; -use crate::memory_optimization::auto_batch_size::{AutoBatchSizer, BatchSizeConfig}; use crate::TrainingMetrics; use super::super::config::{DQNAgentType, DQNHyperparameters}; use super::DQNTrainer; @@ -77,43 +76,12 @@ impl DQNTrainer { full_dims, param_count, model_overhead_mb ); - // Dynamic batch sizing: fully VRAM-derived, no hardcoded caps. - // AutoBatchSizer computes the safe maximum from free GPU memory. - let max_safe_batch = match AutoBatchSizer::new() { - Ok(sizer) => { - let config = BatchSizeConfig { - model_memory_mb: model_overhead_mb, - safety_margin: 0.15, - ..BatchSizeConfig::default() - }; - let safe = sizer.max_safe_batch_size(&config); - info!( - "AutoBatchSizer: GPU VRAM ceiling = {} (configured: {})", - safe, hyperparams.batch_size - ); - safe - } - Err(e) => { - info!("AutoBatchSizer unavailable ({e}), using batch_size as-is"); - hyperparams.batch_size.max(64) - } - }; - - // batch_size == 0 -> auto-compute from VRAM (no artificial cap) + // batch_size is configured per GPU profile (h100.toml, rtx3050.toml). + // No auto-sizing — the config is the source of truth. if hyperparams.batch_size == 0 { - hyperparams.batch_size = max_safe_batch.min(8192); // fallback only — profiles should set batch_size - info!("AutoBatchSizer: batch_size auto-computed to {}", hyperparams.batch_size); - } - - - // Cap to VRAM ceiling (never exceed what the GPU can handle) - if hyperparams.batch_size > max_safe_batch { - info!( - "DQN batch_size capped from {} -> {} (VRAM ceiling)", - hyperparams.batch_size, max_safe_batch - ); - hyperparams.batch_size = max_safe_batch.min(8192); // fallback only — profiles should set batch_size + hyperparams.batch_size = 1024; // sensible default if somehow unset } + info!("DQN batch_size: {} (from config)", hyperparams.batch_size); // Use override device if provided (hyperopt shares one CUDA context), // otherwise require CUDA GPU -- no CPU fallback in CUDA builds.