pub struct ShardFiles { /* private fields */ }Expand description
Every shard of a split GGUF, opened once for the process lifetime. The header is parsed through the loader’s own reader and the mmap is dropped: nothing here goes through the page cache but the reads we ask for.
Implementations§
Source§impl ShardFiles
impl ShardFiles
Sourcepub fn open(first: &Path) -> Result<Self>
pub fn open(first: &Path) -> Result<Self>
Open the shard set that first (the split.no == 0 file) names.
Sourcepub fn open_dir(dir: &Path) -> Result<Self>
pub fn open_dir(dir: &Path) -> Result<Self>
Open the model in dir (shard 0 found as the loader finds it).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn path(&self, shard: usize) -> &Path
pub fn file(&self, shard: usize) -> &File
Sourcepub fn direct_file(&self, shard: usize) -> Option<&File>
pub fn direct_file(&self, shard: usize) -> Option<&File>
The O_DIRECT descriptor of shard, if it opened.
Sourcepub fn locate_q2k(&self, name: &str) -> Option<(usize, u64, usize)>
pub fn locate_q2k(&self, name: &str) -> Option<(usize, u64, usize)>
(shard, absolute offset, bytes) of tensor name if it is stored as
Q2_K (84 B super-blocks of 256): the raw blocks a kernel can read in
place of the loader’s bf16 expansion.
Auto Trait Implementations§
impl Freeze for ShardFiles
impl RefUnwindSafe for ShardFiles
impl Send for ShardFiles
impl Sync for ShardFiles
impl Unpin for ShardFiles
impl UnwindSafe for ShardFiles
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