fix(test): switch smoke_test_real_data to BranchingDuelingQNetwork
DuelingQNetwork uses advantage_fc.* VarMap keys, but GpuExperienceCollector expects branch_0_fc.* (branching always on). Also remove stale use_noisy_nets/use_distributional fields. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -391,7 +391,7 @@ mod gpu_smoke {
|
||||
use ml::cuda_pipeline::gpu_experience_collector::{
|
||||
ExperienceCollectorConfig, GpuExperienceCollector,
|
||||
};
|
||||
use ml::dqn::dueling::{DuelingConfig, DuelingQNetwork};
|
||||
use ml::dqn::branching::{BranchingConfig, BranchingDuelingQNetwork};
|
||||
|
||||
type CudaStream = candle_core::cuda_backend::cudarc::driver::CudaStream;
|
||||
type CudaSlice<T> = candle_core::cuda_backend::cudarc::driver::CudaSlice<T>;
|
||||
@@ -530,9 +530,11 @@ mod gpu_smoke {
|
||||
info!(num_bars, market_dim = 51, "GPU buffer allocated");
|
||||
|
||||
// Create dueling networks (state_dim=54: 51 market + 3 portfolio)
|
||||
let config = DuelingConfig::new(54, 5, vec![256, 256], 128, 128);
|
||||
let online = DuelingQNetwork::new(config.clone(), device.clone()).unwrap();
|
||||
let target_net = DuelingQNetwork::new(config, device.clone()).unwrap();
|
||||
let config = BranchingConfig::trading_default(
|
||||
54, vec![256, 256], 128, vec![5, 3, 3],
|
||||
);
|
||||
let online = BranchingDuelingQNetwork::new(config.clone(), device.clone()).unwrap();
|
||||
let target_net = BranchingDuelingQNetwork::new(config, device.clone()).unwrap();
|
||||
|
||||
let mut collector = GpuExperienceCollector::new(
|
||||
stream.clone(),
|
||||
@@ -560,8 +562,6 @@ mod gpu_smoke {
|
||||
episode_length: timesteps,
|
||||
epsilon: 0.1,
|
||||
gamma: 0.99,
|
||||
use_noisy_nets: false,
|
||||
use_distributional: false,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@@ -615,9 +615,11 @@ mod gpu_smoke {
|
||||
|
||||
info!(num_bars, market_dim = 51, "GPU buffer allocated (with OFI)");
|
||||
|
||||
let config = DuelingConfig::new(54, 5, vec![256, 256], 128, 128);
|
||||
let online = DuelingQNetwork::new(config.clone(), device.clone()).unwrap();
|
||||
let target_net = DuelingQNetwork::new(config, device.clone()).unwrap();
|
||||
let config = BranchingConfig::trading_default(
|
||||
54, vec![256, 256], 128, vec![5, 3, 3],
|
||||
);
|
||||
let online = BranchingDuelingQNetwork::new(config.clone(), device.clone()).unwrap();
|
||||
let target_net = BranchingDuelingQNetwork::new(config, device.clone()).unwrap();
|
||||
|
||||
let mut collector = GpuExperienceCollector::new(
|
||||
stream.clone(),
|
||||
@@ -644,8 +646,6 @@ mod gpu_smoke {
|
||||
episode_length: timesteps,
|
||||
epsilon: 0.1,
|
||||
gamma: 0.99,
|
||||
use_noisy_nets: false,
|
||||
use_distributional: false,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@@ -672,9 +672,7 @@ mod gpu_smoke {
|
||||
|
||||
#[test]
|
||||
fn smoke_gpu_real_data_noisy_distributional() -> Result<(), anyhow::Error> {
|
||||
use ml::dqn::distributional_dueling::{
|
||||
DistributionalDuelingConfig, DistributionalDuelingQNetwork,
|
||||
};
|
||||
use ml::dqn::branching::{BranchingConfig, BranchingDuelingQNetwork};
|
||||
|
||||
let Some(ohlcv_dir) = try_data("ohlcv") else { return Ok(()) };
|
||||
let Some(device) = try_cuda() else { return Ok(()) };
|
||||
@@ -683,9 +681,11 @@ mod gpu_smoke {
|
||||
let (market_buf, target_buf, num_bars) =
|
||||
real_market_data(&ohlcv_dir, None, &device)?;
|
||||
|
||||
let config = DistributionalDuelingConfig::new(54, 5, 51, vec![256, 256], 128, 128);
|
||||
let online = DistributionalDuelingQNetwork::new(config.clone(), device.clone()).unwrap();
|
||||
let target_net = DistributionalDuelingQNetwork::new(config, device.clone()).unwrap();
|
||||
let config = BranchingConfig::trading_default(
|
||||
54, vec![256, 256], 128, vec![5, 3, 3],
|
||||
);
|
||||
let online = BranchingDuelingQNetwork::new(config.clone(), device.clone()).unwrap();
|
||||
let target_net = BranchingDuelingQNetwork::new(config, device.clone()).unwrap();
|
||||
|
||||
let mut collector = GpuExperienceCollector::new(
|
||||
stream.clone(),
|
||||
@@ -716,9 +716,7 @@ mod gpu_smoke {
|
||||
episode_length: timesteps,
|
||||
epsilon: 0.0, // NoisyNets handle exploration
|
||||
gamma: 0.99,
|
||||
use_noisy_nets: true,
|
||||
noisy_sigma_init: 0.5,
|
||||
use_distributional: true,
|
||||
num_atoms: 51,
|
||||
v_min: -10.0,
|
||||
v_max: 10.0,
|
||||
|
||||
Reference in New Issue
Block a user