mirror of
https://github.com/huggingface/candle.git
synced 2025-06-18 03:28:50 +00:00
Adapt more examples to the updated safetensor api. (#947)
* Simplify the safetensor usage. * Convert more examples. * Move more examples. * Adapt stable-diffusion.
This commit is contained in:
@ -146,9 +146,7 @@ pub fn main() -> Result<()> {
|
||||
|
||||
// Create the model and load the weights from the file.
|
||||
let model = args.model()?;
|
||||
let weights = unsafe { candle::safetensors::MmapedFile::new(model)? };
|
||||
let weights = weights.deserialize()?;
|
||||
let vb = VarBuilder::from_safetensors(vec![weights], DType::F32, &Device::Cpu);
|
||||
let vb = unsafe { VarBuilder::from_mmaped_safetensors(&[model], DType::F32, &Device::Cpu)? };
|
||||
let config = args.config()?;
|
||||
let darknet = darknet::parse_config(config)?;
|
||||
let model = darknet.build_model(vb)?;
|
||||
|
Reference in New Issue
Block a user