pub struct MmapedSafetensors { /* private fields */ }
Implementations§
Source§impl MmapedSafetensors
impl MmapedSafetensors
Sourcepub unsafe fn new<P: AsRef<Path>>(p: P) -> Result<Self>
pub unsafe fn new<P: AsRef<Path>>(p: P) -> Result<Self>
Creates a wrapper around a memory mapped file and deserialize the safetensors header.
§Safety
The unsafe is inherited from memmap2::MmapOptions
.
Sourcepub unsafe fn multi<P: AsRef<Path>>(paths: &[P]) -> Result<Self>
pub unsafe fn multi<P: AsRef<Path>>(paths: &[P]) -> Result<Self>
Creates a wrapper around multiple memory mapped file and deserialize the safetensors headers.
If a tensor name appears in multiple files, the last entry is returned.
§Safety
The unsafe is inherited from memmap2::MmapOptions
.
pub fn load(&self, name: &str, dev: &Device) -> Result<Tensor>
pub fn tensors(&self) -> Vec<(String, TensorView<'_>)>
pub fn get(&self, name: &str) -> Result<TensorView<'_>>
Auto Trait Implementations§
impl Freeze for MmapedSafetensors
impl RefUnwindSafe for MmapedSafetensors
impl Send for MmapedSafetensors
impl Sync for MmapedSafetensors
impl Unpin for MmapedSafetensors
impl UnwindSafe for MmapedSafetensors
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more