pub struct ShardInfo {
pub shard_index: u32,
pub total_shards: u32,
pub filename: String,
pub file_size: Option<u64>,
pub preceding_bytes: Option<u64>,
pub group_total_bytes: Option<u64>,
}Expand description
Information about a shard within a sharded model download.
preceding_bytes and
group_total_bytes carry the exact byte offsets
of this shard within the whole model, so aggregate progress does not have to
assume every shard is the same size. GGUF shard sets almost always end with
a smaller final shard, and estimating the group total as
this_shard_size * shard_count made the percentage both wrong and
discontinuous at every shard boundary.
Fields§
§shard_index: u320-based index of this shard.
total_shards: u32Total number of shards in this model.
filename: StringThe specific filename for this shard.
file_size: Option<u64>Size of this shard file in bytes (if known).
preceding_bytes: Option<u64>Summed size of every shard before this one (if all sizes are known).
group_total_bytes: Option<u64>Summed size of every shard in the group (if all sizes are known).
Implementations§
Source§impl ShardInfo
impl ShardInfo
Sourcepub fn new(
shard_index: u32,
total_shards: u32,
filename: impl Into<String>,
) -> Self
pub fn new( shard_index: u32, total_shards: u32, filename: impl Into<String>, ) -> Self
Create a new ShardInfo instance.
Sourcepub fn with_size(
shard_index: u32,
total_shards: u32,
filename: impl Into<String>,
file_size: u64,
) -> Self
pub fn with_size( shard_index: u32, total_shards: u32, filename: impl Into<String>, file_size: u64, ) -> Self
Create a new ShardInfo instance with file size.
Sourcepub const fn with_group_offsets(self, preceding: u64, group_total: u64) -> Self
pub const fn with_group_offsets(self, preceding: u64, group_total: u64) -> Self
Attach the exact byte offsets of this shard within its group.
Only call this when every shard size in the group is known; a partial offset is worse than none, because the fallback estimate at least stays self-consistent.