mirror of
https://github.com/huggingface/candle.git
synced 2025-06-22 20:38:06 +00:00
Expose some helper functions to create quantized models. (#1837)
This commit is contained in:
@ -35,6 +35,14 @@ pub struct Linear {
|
||||
}
|
||||
|
||||
impl Linear {
|
||||
pub fn from_arc(
|
||||
weight: std::sync::Arc<candle::quantized::QTensor>,
|
||||
bias: Option<Tensor>,
|
||||
) -> Result<Self> {
|
||||
let weight = QMatMul::from_weights(weight)?;
|
||||
Ok(Self { weight, bias })
|
||||
}
|
||||
|
||||
pub fn from_weights(weight: QMatMul, bias: Option<Tensor>) -> Self {
|
||||
Self { weight, bias }
|
||||
}
|
||||
|
Reference in New Issue
Block a user