pub struct HfSafetensors { /* private fields */ }Expand description
HuggingFace SafeTensors model loader
Implementations§
Source§impl HfSafetensors
impl HfSafetensors
Sourcepub fn from_file(path: &Path) -> Result<HfSafetensors, SafetensorsError>
pub fn from_file(path: &Path) -> Result<HfSafetensors, SafetensorsError>
Load from a local safetensors file
Sourcepub fn from_bytes(data: Vec<u8>) -> Result<HfSafetensors, SafetensorsError>
pub fn from_bytes(data: Vec<u8>) -> Result<HfSafetensors, SafetensorsError>
Load from raw bytes
Sourcepub fn from_hub(repo_id: &str) -> Result<HfSafetensors, SafetensorsError>
pub fn from_hub(repo_id: &str) -> Result<HfSafetensors, SafetensorsError>
Download from HuggingFace Hub
Sourcepub fn tensor_names(&self) -> &[String]
pub fn tensor_names(&self) -> &[String]
List all tensor names
Sourcepub fn tensor(&self, name: &str) -> Result<TensorData, SafetensorsError>
pub fn tensor(&self, name: &str) -> Result<TensorData, SafetensorsError>
Get a specific tensor by name
Sourcepub fn compare_all<F>(
&self,
get_apr_tensor: F,
threshold: f64,
) -> Vec<TensorComparison>
pub fn compare_all<F>( &self, get_apr_tensor: F, threshold: f64, ) -> Vec<TensorComparison>
Compare all tensors against an APR model
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HfSafetensors
impl RefUnwindSafe for HfSafetensors
impl Send for HfSafetensors
impl Sync for HfSafetensors
impl Unpin for HfSafetensors
impl UnsafeUnpin for HfSafetensors
impl UnwindSafe for HfSafetensors
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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