mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 10:38:54 +00:00
Enhance pickle to retrieve state_dict with a given key (#1671)
This commit is contained in:

committed by
GitHub

parent
a90fc5ca5a
commit
b75e8945bc
@ -484,7 +484,7 @@ impl<'a> VarBuilder<'a> {
|
||||
|
||||
/// Initializes a `VarBuilder` that retrieves tensors stored in a pytorch pth file.
|
||||
pub fn from_pth<P: AsRef<std::path::Path>>(p: P, dtype: DType, dev: &Device) -> Result<Self> {
|
||||
let pth = candle::pickle::PthTensors::new(p)?;
|
||||
let pth = candle::pickle::PthTensors::new(p, None)?;
|
||||
Ok(Self::from_backend(Box::new(pth), dtype, dev.clone()))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user