pub struct GptqLayer;
Trait Implementations§
source§impl QuantMethod for GptqLayer
impl QuantMethod for GptqLayer
fn new(method: QuantMethodConfig) -> Result<Self>where
Self: Sized,
fn dequantize_w(&self) -> Result<Tensor>
source§fn forward(&self, _a: &Tensor) -> Result<Tensor>
fn forward(&self, _a: &Tensor) -> Result<Tensor>
Compute matmul of
self
and a
. self
should contain the weights.source§fn quantized_act_type(&self) -> Option<DType>
fn quantized_act_type(&self) -> Option<DType>
If a quantized method, return the activation dtype.
source§fn add_delta_w(&self, _delta: &Tensor) -> Result<Arc<dyn QuantMethod>>
fn add_delta_w(&self, _delta: &Tensor) -> Result<Arc<dyn QuantMethod>>
Add a delta weight from LoRA to the weights. This should be prescaled with alpha.
source§fn dtype_and_device(&self) -> (DType, Device)
fn dtype_and_device(&self) -> (DType, Device)
Weight dtype and device
source§fn get_bias_mut(&mut self) -> Option<&mut Tensor>
fn get_bias_mut(&mut self) -> Option<&mut Tensor>
If the quant is backed by a qmatmul.
source§fn apply_isq(
self: Arc<Self>,
_dtype: Option<IsqType>,
_device: Device,
_n_quantized: &AtomicUsize,
_imatrix_weight: Option<Vec<f32>>,
) -> Result<Arc<dyn QuantMethod>>
fn apply_isq( self: Arc<Self>, _dtype: Option<IsqType>, _device: Device, _n_quantized: &AtomicUsize, _imatrix_weight: Option<Vec<f32>>, ) -> Result<Arc<dyn QuantMethod>>
If the quant is backed by a qmatmul.
fn get_max_isq_cpu_threads(&self, _dtype: IsqType) -> Option<NonZeroUsize>
source§fn maybe_to_gguf_quant(self: Arc<Self>) -> Result<Arc<dyn QuantMethod>>
fn maybe_to_gguf_quant(self: Arc<Self>) -> Result<Arc<dyn QuantMethod>>
Convert to an equivalent gguf quantization, if applicable.
source§fn forward_autocast(&self, a: &Tensor) -> Result<Tensor>
fn forward_autocast(&self, a: &Tensor) -> Result<Tensor>
Compute matmul of
self
and a
. self
should contain the weights.
Automatically cast to required quantization actiation type and backsource§fn forward_via_half(&self, a: &Tensor) -> Result<Tensor>
fn forward_via_half(&self, a: &Tensor) -> Result<Tensor>
Compute matmul of
self
and a
. self
should contain the weights.
This may go via half precision if it is supported.fn unquant_weight_bias(&self) -> Option<(Tensor, Option<Tensor>)>
source§fn begin_track_stats(&mut self) -> Result<()>
fn begin_track_stats(&mut self) -> Result<()>
Begin tracking stats into an ImatrixLayerStats
source§fn end_track_stats(&self) -> Result<Tensor>
fn end_track_stats(&self) -> Result<Tensor>
End tracking stats into an ImatrixLayerStats. Returns the computed imatrix.
Auto Trait Implementations§
impl Freeze for GptqLayer
impl RefUnwindSafe for GptqLayer
impl Send for GptqLayer
impl Sync for GptqLayer
impl Unpin for GptqLayer
impl UnwindSafe for GptqLayer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more