pub enum BnbLinear {
Fp4Nf4 {
weight: Tensor,
bias: Option<Tensor>,
params: BnbQuantParmas,
quant_ty: BnbQuantType,
},
Int8 {
weight: Tensor,
scb: Tensor,
bias: Option<Tensor>,
},
}Variants§
Implementations§
Trait Implementations§
Source§impl QuantMethod for BnbLinear
impl QuantMethod for BnbLinear
fn new(method: QuantMethodConfig) -> Result<Self>where
Self: Sized,
fn dequantize_w(&self, out_ty: DType) -> Result<Tensor>
Source§fn forward(&self, xs: &Tensor) -> Result<Tensor>
fn forward(&self, xs: &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 to_device(&self, dev: &Device) -> Result<Arc<dyn QuantMethod>>
fn to_device(&self, dev: &Device) -> Result<Arc<dyn QuantMethod>>
Cast this layer to the given device.
fn size_in_bytes(&self) -> Result<usize>
fn device(&self) -> Device
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.Auto Trait Implementations§
impl Freeze for BnbLinear
impl !RefUnwindSafe for BnbLinear
impl Send for BnbLinear
impl Sync for BnbLinear
impl Unpin for BnbLinear
impl !UnwindSafe for BnbLinear
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
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