-
Notifications
You must be signed in to change notification settings - Fork 438
[safetensors] add named groups to RE_SAFETENSORS_SHARD_FILE regex #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -14,7 +14,7 @@ export const SAFETENSORS_INDEX_FILE = "model.safetensors.index.json"; | |||
/// but in some situations safetensors weights have different filenames. | |||
export const RE_SAFETENSORS_FILE = /\.safetensors$/; | |||
export const RE_SAFETENSORS_INDEX_FILE = /\.safetensors\.index\.json$/; | |||
export const RE_SAFETENSORS_SHARD_FILE = /\d{5}-of-\d{5}\.safetensors$/; | |||
export const RE_SAFETENSORS_SHARD_FILE = /(?<shard>\d{5})-of-(?<total>\d{5})\.safetensors$/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well add the "prefix" group? If you're planning on extracting it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case add [_-]
between the captured prefix and the shard number
(most models on the hub use a dash at this position (it's what's generated by transformers), but not bigscience/bloom
)
@@ -14,7 +14,7 @@ export const SAFETENSORS_INDEX_FILE = "model.safetensors.index.json"; | |||
/// but in some situations safetensors weights have different filenames. | |||
export const RE_SAFETENSORS_FILE = /\.safetensors$/; | |||
export const RE_SAFETENSORS_INDEX_FILE = /\.safetensors\.index\.json$/; | |||
export const RE_SAFETENSORS_SHARD_FILE = /\d{5}-of-\d{5}\.safetensors$/; | |||
export const RE_SAFETENSORS_SHARD_FILE = /(?<shard>\d{5})-of-(?<total>\d{5})\.safetensors$/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case add [_-]
between the captured prefix and the shard number
(most models on the hub use a dash at this position (it's what's generated by transformers), but not bigscience/bloom
)
Co-authored-by: Eliott C. <[email protected]>
gguf equivalent for #622 (comment)
follow up to #622 (comment) > but that was my point, the -_ is not optional > we do want to enforce some level of convention
add named groups to RE_SAFETENSORS_SHARD_FILE regex
safetensors equivalent of #621