refactor(ml): use canonical DeviceConfig from gpu module in Liquid CfC
Replace local DeviceConfig enum definition in liquid/candle_cfc.rs with a re-export from the central crate::gpu::DeviceConfig, eliminating duplication while preserving all existing API and tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,29 +11,8 @@ use serde::{Deserialize, Serialize};
|
||||
use crate::cuda_compat::manual_sigmoid;
|
||||
use crate::MLError;
|
||||
|
||||
/// Device configuration for CfC training
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub enum DeviceConfig {
|
||||
Cpu,
|
||||
Cuda(usize),
|
||||
Auto,
|
||||
}
|
||||
|
||||
impl DeviceConfig {
|
||||
pub fn resolve(&self) -> Result<Device, MLError> {
|
||||
match self {
|
||||
DeviceConfig::Cpu => Ok(Device::Cpu),
|
||||
DeviceConfig::Cuda(id) => Device::new_cuda(*id).map_err(|e| {
|
||||
MLError::ConfigurationError(format!(
|
||||
"CUDA device {} required but unavailable: {}",
|
||||
id, e
|
||||
))
|
||||
}),
|
||||
DeviceConfig::Auto => Device::cuda_if_available(0)
|
||||
.map_err(|e| MLError::ConfigurationError(format!("Auto device error: {}", e))),
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Device configuration for CfC training — re-exported from central gpu module.
|
||||
pub use crate::gpu::DeviceConfig;
|
||||
|
||||
/// CfC v2 training configuration
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user