use std::sync::Arc;
use crate::config::MambaConfig;
use crate::mamba_ssm::gpu::context::GpuCtx;
use crate::mamba_ssm::gpu::dtype::WeightDtype;
use crate::mamba_ssm::gpu::weights::{GpuMambaMixedWeights, GpuMambaTrainWeights};
use crate::weights::MambaWeights;
pub struct GpuMambaTrainMixedWeights {
pub master: GpuMambaTrainWeights,
pub compute: GpuMambaMixedWeights,
pub dtype: WeightDtype,
}
impl GpuMambaTrainMixedWeights {
pub fn from_cpu(
stream: &Arc<cudarc::driver::CudaStream>,
cpu: &MambaWeights,
cfg: &MambaConfig,
dtype: WeightDtype,
) -> Result<Self, String> {
let master = GpuMambaTrainWeights::from_cpu(stream, cpu)?;
let compute = GpuMambaMixedWeights::from_cpu(stream, cpu, cfg, dtype)?;
Ok(Self {
master,
compute,
dtype,
})
}
pub fn sync_master_to_compute(&self, ctx: &GpuCtx) -> Result<(), String> {
let _ = ctx;
Ok(())
}
}