feat(ml): PPO mixed precision auto-detection — BF16 on A100/H100
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -305,6 +305,21 @@ impl PpoTrainer {
|
||||
config.gae_config.gamma = hyperparams.gamma as f32;
|
||||
config.gae_config.lambda = hyperparams.gae_lambda;
|
||||
|
||||
// Auto-detect mixed precision capability based on GPU architecture
|
||||
if device.is_cuda() {
|
||||
match crate::memory_optimization::auto_batch_size::detect_gpu_memory() {
|
||||
Ok((_total, _free, ref name)) => {
|
||||
let detected = crate::dqn::mixed_precision::detect_from_gpu_name(name);
|
||||
match &detected {
|
||||
Some(c) => info!("PPO mixed precision: {:?} enabled (GPU: {})", c.dtype, name),
|
||||
None => info!("PPO mixed precision: disabled (GPU: {})", name),
|
||||
}
|
||||
config.mixed_precision = detected;
|
||||
}
|
||||
Err(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
// Create PPO model with specified device (GPU or CPU)
|
||||
let model = PPO::with_device(config, device.clone())?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user