Skip to main content

SafetensorsMmapBackend

Struct SafetensorsMmapBackend 

Source
pub struct SafetensorsMmapBackend { /* private fields */ }
Expand description

Checkpoint over a memory-mapped crate::safetensors::SafetensorsCheckpointMmap (borrowed payloads).

Callers must not truncate shard files while the backend is alive (standard mmap invariant).

Implementations§

Source§

impl SafetensorsMmapBackend

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self>

Map a .safetensors file, *.safetensors.index.json, or shard directory.

Source

pub fn checkpoint(&self) -> &SafetensorsCheckpointMmap

Format-specific mapped handle.

Source

pub fn into_checkpoint(self) -> SafetensorsCheckpointMmap

Unwrap into the format-specific mapped handle.

Trait Implementations§

Source§

impl Checkpoint for SafetensorsMmapBackend

Available on crate feature mmap only.
Source§

fn source(&self) -> &CheckpointSource

Checkpoint identity: format, input path, root, payload files.
Source§

fn tensors(&self) -> &[TensorInfo]

Every tensor, sorted by name.
Source§

fn metadata(&self) -> &CheckpointMetadata

Scalar metadata.
Source§

fn tensor_bytes(&self, name: &str) -> Result<Cow<'_, [u8]>>

Raw payload bytes of name, length TensorInfo::byte_len.
Source§

fn format(&self) -> CheckpointFormat

Container format.
Source§

fn tensor(&self, name: &str) -> Option<&TensorInfo>

Look up one tensor by exact name.
Source§

impl Debug for SafetensorsMmapBackend

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for SafetensorsMmapBackend

§

impl Freeze for SafetensorsMmapBackend

§

impl Move for SafetensorsMmapBackend

§

impl RefUnwindSafe for SafetensorsMmapBackend

§

impl Send for SafetensorsMmapBackend
where &'static str: Send, RawVecInner: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, NodeRef<Owned, String, MappedShard, LeafOrInternal>: Send, BoxRaw<(String, MappedShard)>: Send, NodeRef<Owned, String, usize, LeafOrInternal>: Send, BoxRaw<(String, usize)>: Send, NodeRef<Owned, String, MetadataValue, LeafOrInternal>: Send, BoxRaw<(String, MetadataValue)>: Send,

§

impl Sync for SafetensorsMmapBackend
where RawVecInner: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, NodeRef<Owned, String, MappedShard, LeafOrInternal>: Sync, BoxRaw<(String, MappedShard)>: Sync, NodeRef<Owned, String, usize, LeafOrInternal>: Sync, BoxRaw<(String, usize)>: Sync, NodeRef<Owned, String, MetadataValue, LeafOrInternal>: Sync, BoxRaw<(String, MetadataValue)>: Sync,

§

impl Unpin for SafetensorsMmapBackend
where &'static str: Unpin, *const u8 is !null: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, *const LeafNode<String, MappedShard> is !null: Unpin, Box<(String, MappedShard)>: Unpin, *const LeafNode<String, usize> is !null: Unpin, Box<(String, usize)>: Unpin, *const LeafNode<String, MetadataValue> is !null: Unpin, Box<(String, MetadataValue)>: Unpin,

§

impl UnsafeUnpin for SafetensorsMmapBackend

§

impl UnwindSafe for SafetensorsMmapBackend

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.