Add a quantized blip model. (#1155)

* Add a quantized blip model.

* Integrate the quantized blip model to the actual example.
This commit is contained in:
Laurent Mazare
2023-10-22 20:33:25 +01:00
committed by GitHub
parent 8a82d623e5
commit a11af79e23
5 changed files with 795 additions and 17 deletions

View File

@ -34,6 +34,12 @@ pub struct Linear {
bias: Option<Tensor>,
}
impl Linear {
pub fn from_weights(weight: QMatMul, bias: Option<Tensor>) -> Self {
Self { weight, bias }
}
}
impl Module for Linear {
fn forward(&self, x: &Tensor) -> candle::Result<Tensor> {
let x = x.apply(&self.weight)?;