Skip to main content

AnyCheckpoint

Enum AnyCheckpoint 

Source
#[non_exhaustive]
pub enum AnyCheckpoint { Gguf(GgufBackend), GgufMmap(GgufMmapBackend), Safetensors(SafetensorsBackend), SafetensorsMmap(SafetensorsMmapBackend), }
Expand description

A checkpoint whose backend was chosen at runtime.

Implements Checkpoint by delegation. The as_* accessors return the format-specific handle when consumers need format-only features.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Gguf(GgufBackend)

Owned GGUF layout.

§

GgufMmap(GgufMmapBackend)

Memory-mapped GGUF layout.

§

Safetensors(SafetensorsBackend)

Safetensors with bounded owned reads.

§

SafetensorsMmap(SafetensorsMmapBackend)

Memory-mapped Safetensors shards.

Implementations§

Source§

impl AnyCheckpoint

Source

pub fn as_dyn(&self) -> &dyn Checkpoint

The active backend as a trait object.

Source

pub fn as_gguf(&self) -> Option<&GgufLayout>

Source

pub fn as_gguf_mmap(&self) -> Option<&GgufLayoutMmap>

Memory-mapped GGUF layout.

Source

pub fn as_safetensors(&self) -> Option<&SafetensorsCheckpoint>

Safetensors handle (manifest, MoE candidates, record lookup).

Source

pub fn as_safetensors_mmap(&self) -> Option<&SafetensorsCheckpointMmap>

Memory-mapped Safetensors handle.

Trait Implementations§

Source§

impl Checkpoint for AnyCheckpoint

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 tensor(&self, name: &str) -> Option<&TensorInfo>

Look up one tensor by exact 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§

impl Debug for AnyCheckpoint

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for AnyCheckpoint

§

impl Freeze for AnyCheckpoint

§

impl Move for AnyCheckpoint

§

impl RefUnwindSafe for AnyCheckpoint

§

impl Send for AnyCheckpoint
where RawVecInner: Send, RawTable<(String, String)>: Send, RawTable<(String, u64)>: Send, RawTable<(String, i64)>: Send, RawTable<(String, f32)>: Send, RawTable<(String, f64)>: Send, RawTable<(String, Tensor)>: Send, NodeRef<Owned, String, MetadataValue, LeafOrInternal>: Send, BoxRaw<(String, MetadataValue)>: Send, MmapInner: Send, &'static str: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, NodeRef<Owned, String, ResolvedShard, LeafOrInternal>: Send, BoxRaw<(String, ResolvedShard)>: Send, NodeRef<Owned, String, usize, LeafOrInternal>: Send, BoxRaw<(String, usize)>: Send, NodeRef<Owned, String, MappedShard, LeafOrInternal>: Send, BoxRaw<(String, MappedShard)>: Send,

§

impl Sync for AnyCheckpoint
where RawVecInner: Sync, RawTable<(String, String)>: Sync, RawTable<(String, u64)>: Sync, RawTable<(String, i64)>: Sync, RawTable<(String, f32)>: Sync, RawTable<(String, f64)>: Sync, RawTable<(String, Tensor)>: Sync, NodeRef<Owned, String, MetadataValue, LeafOrInternal>: Sync, BoxRaw<(String, MetadataValue)>: Sync, MmapInner: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, NodeRef<Owned, String, ResolvedShard, LeafOrInternal>: Sync, BoxRaw<(String, ResolvedShard)>: Sync, NodeRef<Owned, String, usize, LeafOrInternal>: Sync, BoxRaw<(String, usize)>: Sync, NodeRef<Owned, String, MappedShard, LeafOrInternal>: Sync, BoxRaw<(String, MappedShard)>: Sync,

§

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

§

impl UnsafeUnpin for AnyCheckpoint

§

impl UnwindSafe for AnyCheckpoint

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.