feat(dqn): wire gradient explosion and checkpoint save metrics into trainer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-03-03 00:34:41 +01:00
parent 2642286c86
commit ca8b77f63a

View File

@@ -2637,6 +2637,7 @@ impl DQNTrainer {
warn!(" • Reducing learning rate (current: {:.2e})", self.hyperparams.learning_rate);
warn!(" • Enabling target network soft updates (Polyak averaging, tau=0.005)");
warn!(" • Adjusting reward scaling");
training_metrics::record_gradient_explosion("dqn", "current");
}
}
@@ -2799,12 +2800,15 @@ impl DQNTrainer {
}
}
let ckpt_size = checkpoint_data.len() as f64;
let ckpt_start = std::time::Instant::now();
let best_checkpoint_path = checkpoint_callback(
epoch + 1,
checkpoint_data,
true, // is_best flag
)
.context("Failed to save best checkpoint")?;
training_metrics::record_checkpoint_save("dqn", "current", ckpt_start.elapsed().as_secs_f64(), ckpt_size);
info!("Best model saved to: {}", best_checkpoint_path);
}