MCPcopy Create free account
hub / github.com/evilsocket/cake / load_all

Method load_all

cake-core/src/utils/tensor_storage.rs:296–307  ·  view source on GitHub ↗

Load all tensors as a HashMap suitable for VarBuilder::from_tensors().

(
        &self,
        dtype: candle_core::DType,
        device: &candle_core::Device,
    )

Source from the content-addressed store, hash-verified

294
295 /// Load all tensors as a HashMap suitable for VarBuilder::from_tensors().
296 pub fn load_all(
297 &self,
298 dtype: candle_core::DType,
299 device: &candle_core::Device,
300 ) -> Result<HashMap<String, candle_core::Tensor>> {
301 let mut map = HashMap::with_capacity(self.index.len());
302 for name in self.index.keys() {
303 let tensor = self.load_tensor(name, dtype, device)?;
304 map.insert(name.clone(), tensor);
305 }
306 Ok(map)
307 }
308
309 /// Build from a multi-shard model with index JSON.
310 fn from_index_json(index_path: &Path) -> Result<Self> {

Callers 2

loadMethod · 0.80

Calls 2

load_tensorMethod · 0.45
cloneMethod · 0.45

Tested by 1