diff options
author | Laurent Mazare <laurent.mazare@gmail.com> | 2023-09-23 21:26:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-23 21:26:03 +0100 |
commit | bb3471ea31e637fc02106e1431d4126855ea22e1 (patch) | |
tree | 8494aec21d5f221e16432efc0865c0633466cb0b /candle-examples/examples/efficientnet | |
parent | 890d069092a3158838b82f3d8fbdf709c84e8770 (diff) | |
download | candle-bb3471ea31e637fc02106e1431d4126855ea22e1.tar.gz candle-bb3471ea31e637fc02106e1431d4126855ea22e1.tar.bz2 candle-bb3471ea31e637fc02106e1431d4126855ea22e1.zip |
Adapt more examples to the updated safetensor api. (#947)
* Simplify the safetensor usage.
* Convert more examples.
* Move more examples.
* Adapt stable-diffusion.
Diffstat (limited to 'candle-examples/examples/efficientnet')
-rw-r--r-- | candle-examples/examples/efficientnet/main.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/candle-examples/examples/efficientnet/main.rs b/candle-examples/examples/efficientnet/main.rs index 1e45e301..0e4a2864 100644 --- a/candle-examples/examples/efficientnet/main.rs +++ b/candle-examples/examples/efficientnet/main.rs @@ -68,9 +68,7 @@ pub fn main() -> anyhow::Result<()> { } Some(model) => model.into(), }; - let weights = unsafe { candle::safetensors::MmapedFile::new(model_file)? }; - let weights = weights.deserialize()?; - let vb = VarBuilder::from_safetensors(vec![weights], DType::F32, &device); + let vb = unsafe { VarBuilder::from_mmaped_safetensors(&[model_file], DType::F32, &device)? }; let cfg = match args.which { Which::B0 => MBConvConfig::b0(), Which::B1 => MBConvConfig::b1(), |