refactor: remove batch_size CLI override from train_baseline_rl
All VRAM-derived parameters (batch_size, gpu_n_episodes, buffer_size) are auto-scaled — CLI overrides bypass this and cause inconsistent behavior between local testing and production. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -133,9 +133,7 @@ struct Args {
|
||||
#[arg(long, default_value_t = 50)]
|
||||
epochs: usize,
|
||||
|
||||
/// Training batch size
|
||||
#[arg(long, default_value_t = 0)]
|
||||
batch_size: usize,
|
||||
// batch_size always auto-scaled from VRAM (no CLI override).
|
||||
|
||||
/// Path to directory containing .dbn.zst files (env: FOXHUNT_DATA_DIR)
|
||||
#[arg(long, env = "FOXHUNT_DATA_DIR")]
|
||||
@@ -513,7 +511,7 @@ fn train_dqn_fold(
|
||||
|
||||
let mut hyperparams = DQNHyperparameters {
|
||||
learning_rate: hp_f64(hp, "learning_rate").unwrap_or(args.learning_rate),
|
||||
batch_size: hp_usize(hp, "batch_size").unwrap_or(args.batch_size),
|
||||
batch_size: hp_usize(hp, "batch_size").unwrap_or(0), // 0 = auto from VRAM
|
||||
gamma: hp_f64(hp, "gamma").unwrap_or(0.95),
|
||||
epsilon_start,
|
||||
epsilon_end: hp_f64(hp, "epsilon_end").unwrap_or(0.01),
|
||||
@@ -576,7 +574,7 @@ fn train_dqn_fold(
|
||||
hyperparams.epochs = args.epochs;
|
||||
// Only override batch_size from CLI/hyperopt if explicitly non-zero.
|
||||
// batch_size=0 is the auto-compute sentinel — let the constructor handle it.
|
||||
let hp_batch = hp_usize(hp, "batch_size").unwrap_or(args.batch_size);
|
||||
let hp_batch = hp_usize(hp, "batch_size").unwrap_or(0_usize /* auto from VRAM */);
|
||||
if hp_batch > 0 {
|
||||
hyperparams.batch_size = hp_batch;
|
||||
}
|
||||
@@ -704,7 +702,7 @@ fn train_ppo_fold(
|
||||
learning_rate: hp_f64(hp, "learning_rate").unwrap_or(args.learning_rate),
|
||||
actor_learning_rate: Some(hp_f64(hp, "policy_learning_rate").unwrap_or(args.learning_rate)),
|
||||
critic_learning_rate: Some(hp_f64(hp, "value_learning_rate").unwrap_or(args.learning_rate * 3.0)),
|
||||
batch_size: hp_usize(hp, "batch_size").unwrap_or(args.batch_size.max(64)),
|
||||
batch_size: hp_usize(hp, "batch_size").unwrap_or(0_usize /* auto from VRAM */.max(64)),
|
||||
gamma: hp_f64(hp, "gamma").unwrap_or(0.99),
|
||||
clip_epsilon: hp_f64(hp, "clip_epsilon").unwrap_or(0.2) as f32,
|
||||
vf_coef: hp_f64(hp, "value_loss_coeff").unwrap_or(0.5) as f32,
|
||||
@@ -796,7 +794,7 @@ fn run_training(args: &Args) -> Result<Vec<RlTrainingResult>> {
|
||||
info!(" Model(s): {}", args.model);
|
||||
info!(" Symbol: {}", args.symbol);
|
||||
info!(" Epochs: {}", args.epochs);
|
||||
info!(" Batch size: {}", args.batch_size);
|
||||
info!(" Batch size: {}", 0_usize /* auto from VRAM */);
|
||||
info!(" Data dir: {}", args.data_dir.display());
|
||||
info!(" Output dir: {}", args.output_dir.display());
|
||||
info!(" Feature dim: {}", args.feature_dim);
|
||||
|
||||
Reference in New Issue
Block a user