Support loading from model.safetensors.index.json#6
Support loading from model.safetensors.index.json#6chengchingwen merged 7 commits intoFluxML:mainfrom
model.safetensors.index.json#6Conversation
pxl-th
left a comment
There was a problem hiding this comment.
LGTM! Would be good to add a tests if possible.
|
I noticed that this index file is not covered anywhere in https://huggingface.co/docs/safetensors/index or the safetensors repo. Is it a huggingface-specific thing? Is there a documentation link we can point users to for it? |
|
Added |
chengchingwen
left a comment
There was a problem hiding this comment.
The index.json is defined by huggingface in their python binding for sharding the model weights and is not part of the safetensors format/spec. This should not be in this package (or at least, it should be named as something like load_shard_safetensors instead of modifying load_safetensors.
|
Hi @chengchingwen , I agree this feature is not part of the spec. The reason is that in real world cases, different packages may have different approaches to handle the shards (like loading them distributedly or GC during loading). However, I think the modifications I made here provide a nice-to-have fallback (by loading them all in memory). Regarding the naming issue, reusing the |
It's also part of the reason that I think it should not be in this package, but I agree it would be convenient to have and is a reasonable default for loading sharded weights. Personally, the |
|
Also, some unneeded files should be removed. e.g. |
No description provided.