pub struct SafetensorsSource { /* private fields */ }Expand description
ModelSource over a HuggingFace-format directory:
<dir>/config.json (required)
<dir>/generation_config.json (optional)
<dir>/tokenizer.json (required by the runtime)
<dir>/tokenizer_config.json (optional; chat special tokens)
<dir>/model.safetensors (single-file), or
<dir>/model.safetensors.index.json (sharded)Files are memory-mapped; ModelSource::open_tensor returns zero-copy
views into the mapping.
Implementations§
Trait Implementations§
Source§impl ModelSource for SafetensorsSource
impl ModelSource for SafetensorsSource
Source§fn metadata(&self) -> &ModelMetadata
fn metadata(&self) -> &ModelMetadata
Architecture + hyperparameter metadata.
Source§fn tensor_names(&self) -> Vec<String>
fn tensor_names(&self) -> Vec<String>
Names of all tensors available in this source.
Source§fn open_tensor(&self, name: &str) -> Result<TensorReader<'_>>
fn open_tensor(&self, name: &str) -> Result<TensorReader<'_>>
Opens a tensor by name, returning a lazy reader over the raw bytes.
Source§fn tokenizer(&self) -> Result<TokenizerSpec>
fn tokenizer(&self) -> Result<TokenizerSpec>
Tokenizer specification (path to
tokenizer.json + added tokens).Source§fn sampler_defaults(&self) -> Option<SamplerConfig>
fn sampler_defaults(&self) -> Option<SamplerConfig>
Sampler defaults from
generation_config.json, if present.Auto Trait Implementations§
impl Freeze for SafetensorsSource
impl RefUnwindSafe for SafetensorsSource
impl Send for SafetensorsSource
impl Sync for SafetensorsSource
impl Unpin for SafetensorsSource
impl UnsafeUnpin for SafetensorsSource
impl UnwindSafe for SafetensorsSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more