[Proposal] Remove SafeTensor wrapper (allows finer control for users).

This commit is contained in:
Nicolas Patry
2023-07-19 16:25:44 +02:00
parent 67e20c3792
commit dfd624dbd3
4 changed files with 26 additions and 44 deletions

View File

@ -1,4 +1,7 @@
use candle::{safetensors::SafeTensors, DType, Device, Error, Result, Shape, Tensor};
use candle::{
safetensors::{Load, SafeTensors},
DType, Device, Error, Result, Shape, Tensor,
};
use std::collections::HashMap;
use std::sync::Arc;
@ -170,7 +173,8 @@ impl<'a> VarBuilder<'a> {
.bt()
})?;
safetensors[*index]
.tensor(&path, &data.device)?
.tensor(&path)?
.load(&data.device)?
.to_dtype(data.dtype)?
}
};