-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
According to the spec, the hash should be calculated as "A hash of all tensor content (ie excluding the header section), with 0x prefix, all lowercase, and no byte-separator symbols."
I'm assuming this means we need to calculate the hash of the data as it is saved in the safetensors file itself. For validation of an existing file this is fine, but how do we calculate that hash before saving a model?
Do we need to save the model, read it to calculate the hash, then save it again with the hash included? The safetensors library provides a save function to save into a byte array. But I assume this creates a copy of the entire model in RAM, which is not ideal for big models.
An efficient reference implementation would be nice.
Metadata
Metadata
Assignees
Labels
No labels