Skip to content

Commit

Permalink
[gguf] RE_GGUF_SHARD_FILE named groups (#621)
Browse files Browse the repository at this point in the history
Suggested by @coyotte508
  • Loading branch information
Mishig authored Apr 11, 2024
1 parent 5f213a9 commit e78bc67
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/gguf/src/gguf.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ describe("gguf", () => {
const match = ggufPath.match(RE_GGUF_SHARD_FILE);

expect(RE_GGUF_SHARD_FILE.test(ggufPath)).toEqual(true);
expect(match?.[1]).toEqual("00003");
expect(match?.[2]).toEqual("00009");
expect(match?.groups?.shard).toEqual("00003");
expect(match?.groups?.total).toEqual("00009");
});
});
2 changes: 1 addition & 1 deletion packages/gguf/src/gguf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export { GGUFValueType, GGMLQuantizationType } from "./types";
export { GGUF_QUANT_DESCRIPTIONS } from "./quant-descriptions";

export const RE_GGUF_FILE = /\.gguf$/;
export const RE_GGUF_SHARD_FILE = /-(\d{5})-of-(\d{5})\.gguf$/;
export const RE_GGUF_SHARD_FILE = /-(?<shard>\d{5})-of-(?<total>\d{5})\.gguf$/;

const isVersion = (version: number): version is Version => version === 1 || version === 2 || version === 3;

Expand Down

0 comments on commit e78bc67

Please sign in to comment.