SafeTensorsIndexParser
Parser for model.safetensors.index.json files.
Index files are used for sharded SafeTensors models to map tensor names to their containing shard files.
Usage:
val index = SafeTensorsIndexParser.parse(jsonContent)
println("Shards: ${index.shardCount}")
println("Total size: ${index.metadata.totalSize}")
val shardForTensor = index.getShardForTensor("model.embed_tokens.weight")Content copied to clipboard
Functions
Link copied to clipboard
Derive the expected index filename from a shard filename.
Link copied to clipboard
Check if a file path looks like a SafeTensors index file.
Link copied to clipboard
Check if a filename matches the sharded SafeTensors pattern.
Link copied to clipboard
Parse a SafeTensors index from JSON content.
Link copied to clipboard
Extract shard information from a sharded filename.