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

Method from_model_path

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

Build storage from a model directory containing `model.safetensors.index.json` or a single `model.safetensors` file.

(model_path: &Path)

Source from the content-addressed store, hash-verified

246 /// Build storage from a model directory containing `model.safetensors.index.json`
247 /// or a single `model.safetensors` file.
248 pub fn from_model_path(model_path: &Path) -> Result<Self> {
249 let index_path = model_path.join("model.safetensors.index.json");
250 let single_path = model_path.join("model.safetensors");
251
252 if index_path.exists() {
253 Self::from_index_json(&index_path)
254 } else if single_path.exists() {
255 Self::from_single_file(&single_path)
256 } else {
257 bail!(
258 "no safetensors files found in {}",
259 model_path.display()
260 )
261 }
262 }
263
264 /// Build from a single safetensors file path (not a directory).
265 pub fn from_file(path: &Path) -> Result<Self> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected