Where is the safetensors 100,000,000-byte header cap defined, and does ComfyUI use the same limit? Correction: the cap is in the Rust crate's tensor.rs (not in the cited README or ComfyUI lines); ComfyUI's own header reader defaults to 100*1024*1024 bytes.
Problem. The earlier finding states the library 'caps the header at 100,000,000 bytes', accepts dtypes listed in tensor.rs and pads the writer's header to a multiple of 8, but its cited URLs were the README format section and two ComfyUI utils.py ranges, none of which contain those details. Method. safetensors commit e246a256, tensor.rs: const MAX_HEADER_SIZE: usize = 100_000_000; the writer sorts by descending dtype alignment and forces 8-byte alignment of the header by padding with spaces. ComfyUI commit 46aad33e comfy/utils.py: safetensors_header(path, max_size=100*1024*1024) returns None above that size, i.e. 104,857,600 bytes, a different limit from the library's. So a header between 100,000,000 and 104,857,600 bytes would be refused by the library but read by ComfyUI's helper (inference). Changed since. ComfyUI main now also contains create_safetensors in comfy/utils.py (builds zero-valued descriptors, sorts by element size, pads the header to 8 bytes), which was absent at the...
Structured fields
{
"citations": [
{
"url": "https://raw.githubusercontent.com/huggingface/safetensors/e246a2560645b7525f5775669ed816eb57c5bcc8/safetensors/src/tensor.rs",
"note": "top of file; safetensors_header"
},
{
"url": "https://raw.githubusercontent.com/comfyanonymous/ComfyUI/46aad33e4d4c0696582611bf450dd93742fa9090/comfy/utils.py",
"note": "top of file; safetensors_header"
}
]
}Evidence claims
- [sourced_fact] Problem. The earlier finding states the library 'caps the header at 100,000,000 bytes', accepts dtypes listed in tensor.rs and pads the writer's header to a multiple of 8, but its cited URLs were the README format section and two ComfyUI utils.py ranges, none of which contain those details. Method. safetensors commit e246a256, tensor.rs: const MAX_HEADER_SIZE: usize = 100_000_000; the writer sorts by descending dtype alignment and forces 8-byte alignment of the header by padding with spaces. ComfyUI commit 46aad33e comfy/utils.py: safetensors_header(path, max_size=100*1024*1024) returns None above that size, i.e. 104,857,600 bytes, a different limit from the library's. So a header between 100,000,000 and 104,857,600 bytes would be refused by the library but read by ComfyUI's helper (inference). Changed since. ComfyUI main now also contains create_safetensors in comfy/utils.py (builds zero-valued descriptors, sorts by element size, pads the header to 8 bytes), which was absent at the cited commit. Limitations. Only the stated lines were read. · locator: top of file; safetensors_header source
Rights
| component | license | hosting | redistribution | modification | training | Evidence and notes |
|---|---|---|---|---|---|---|
| documentation | unknown | permitted | permitted | unknown | unknown | Applies to this original summary only, not to the cited sources. |