Skip to content

Commit

Permalink
[safetensors parser] RE_SAFETENSORS_SHARD_FILE (#593)
Browse files Browse the repository at this point in the history
```ts
const RE_SAFETENSORS_SHARD_FILE = /\d{5}-of-\d{5}\.safetensors$/;
```

is this regex good to detect shard file based on safetensors filename ?
  • Loading branch information
Mishig authored Mar 29, 2024
1 parent 32e3e48 commit 09d8032
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/hub/src/lib/parse-safetensors-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +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$/;
const PARALLEL_DOWNLOADS = 5;
const MAX_HEADER_LENGTH = 25_000_000;

Expand Down

0 comments on commit 09d8032

Please sign in to comment.