mistralrs_quant/dummy/
mod.rs
1use candle_core::Result;
2
3use crate::{QuantMethod, QuantizeOntoGuard, QuantizedSerde};
4
5#[derive(Debug, Copy, Clone)]
6pub struct DummyLayer;
7
8impl QuantMethod for DummyLayer {
9 fn new(_method: crate::QuantMethodConfig) -> candle_core::Result<Self>
10 where
11 Self: Sized,
12 {
13 Ok(Self)
14 }
15 fn dequantize_w(&self) -> Result<candle_core::Tensor> {
16 candle_core::bail!("DummyLayer cannot be dequantized!")
17 }
18 fn add_delta_w(
19 &self,
20 _delta: &candle_core::Tensor,
21 ) -> candle_core::Result<std::sync::Arc<dyn QuantMethod>> {
22 candle_core::bail!("DummyLayer should not ever be present in forward pass!")
23 }
24 fn apply_isq(
25 self: std::sync::Arc<Self>,
26 _dtype: Option<crate::IsqType>,
27 _device: candle_core::Device,
28 _n_quantized: &std::sync::atomic::AtomicUsize,
29 _imatrix_weight: Option<Vec<f32>>,
30 _guard: QuantizeOntoGuard,
31 ) -> candle_core::Result<std::sync::Arc<dyn QuantMethod>> {
32 candle_core::bail!("DummyLayer should not ever be present in forward pass!")
33 }
34 fn dtype_and_device(&self) -> (candle_core::DType, candle_core::Device) {
35 (candle_core::DType::F64, candle_core::Device::Cpu)
36 }
37 fn forward(&self, _a: &candle_core::Tensor) -> candle_core::Result<candle_core::Tensor> {
38 candle_core::bail!("DummyLayer should not ever be present in forward pass!")
39 }
40 fn quantized_act_type(&self) -> Option<candle_core::DType> {
41 None
42 }
43}
44
45impl QuantizedSerde for DummyLayer {
46 fn name(&self) -> &'static str {
47 "dummy"
48 }
49}