From 4aeb44901752022b0b22ee39fba146ece908ebe7 Mon Sep 17 00:00:00 2001 From: Laurent Mazare Date: Sun, 24 Sep 2023 11:18:17 +0100 Subject: Depreate the VarBuilder::from_safetensors function. (#951) --- candle-wasm-examples/segment-anything/src/bin/m.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'candle-wasm-examples/segment-anything/src') diff --git a/candle-wasm-examples/segment-anything/src/bin/m.rs b/candle-wasm-examples/segment-anything/src/bin/m.rs index 5140b979..acd903b0 100644 --- a/candle-wasm-examples/segment-anything/src/bin/m.rs +++ b/candle-wasm-examples/segment-anything/src/bin/m.rs @@ -21,11 +21,10 @@ pub struct Model { #[wasm_bindgen] impl Model { #[wasm_bindgen(constructor)] - pub fn new(weights: &[u8], use_tiny: bool) -> Result { + pub fn new(weights: Vec, use_tiny: bool) -> Result { console_error_panic_hook::set_once(); let dev = &Device::Cpu; - let weights = safetensors::tensor::SafeTensors::deserialize(weights)?; - let vb = VarBuilder::from_safetensors(vec![weights], DType::F32, dev); + let vb = VarBuilder::from_buffered_safetensors(weights, DType::F32, dev)?; let sam = if use_tiny { sam::Sam::new_tiny(vb)? // tiny vit_t } else { -- cgit v1.2.3