summaryrefslogtreecommitdiff
path: root/candle-core/examples/tensor-tools.rs
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2023-09-23 15:43:11 +0100
committerGitHub <noreply@github.com>2023-09-23 15:43:11 +0100
commitccf352f3d1dfa8bd7531ef1f6caa198fc85cb663 (patch)
treedd7974ac607858461bec2106a020d3cd38419352 /candle-core/examples/tensor-tools.rs
parent402d207f0f5f71229f0e24272d0f7b9e4c036573 (diff)
downloadcandle-ccf352f3d1dfa8bd7531ef1f6caa198fc85cb663.tar.gz
candle-ccf352f3d1dfa8bd7531ef1f6caa198fc85cb663.tar.bz2
candle-ccf352f3d1dfa8bd7531ef1f6caa198fc85cb663.zip
Use yoke to provide a self-referential container for mmaped safetenso… (#939)
* Use yoke to provide a self-referential container for mmaped safetensor files. * Add the new self-owned type for safetensor files without removing the previous version. * Add routing. * Add an initializer for the case of multiple files.
Diffstat (limited to 'candle-core/examples/tensor-tools.rs')
-rw-r--r--candle-core/examples/tensor-tools.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/candle-core/examples/tensor-tools.rs b/candle-core/examples/tensor-tools.rs
index c0d5a334..3982f2c3 100644
--- a/candle-core/examples/tensor-tools.rs
+++ b/candle-core/examples/tensor-tools.rs
@@ -150,8 +150,7 @@ fn run_ls(file: &std::path::PathBuf, format: Option<Format>, verbose: bool) -> R
}
}
Format::Safetensors => {
- let tensors = unsafe { candle_core::safetensors::MmapedFile::new(file)? };
- let tensors = tensors.deserialize()?;
+ let tensors = unsafe { candle_core::safetensors::MmapedSafetensors::new(file)? };
let mut tensors = tensors.tensors();
tensors.sort_by(|a, b| a.0.cmp(&b.0));
for (name, view) in tensors.iter() {