Closed ryan-the-crayon closed 2 weeks ago
cc: @ngxson
LGTM. Thanks! I don't understand why I missed this line of code :eyes:
@ryan-the-crayon thanks a lot for the contribution! Anyway, you can add a test case ? https://github.com/huggingface/huggingface.js/blob/e2689f8c7b02d8eb05e3b7869f8e02f7e495ea93/packages/gguf/src/gguf.spec.ts#L230-L241
FYI, I made a gguf with 32MB of metadata (metadata usually takes less than 2MB): https://huggingface.co/ngxson/test_gguf_models/blob/main/gguf_test_big_metadata.gguf
The test would be:
const parsedGguf = await gguf(".cache/model.gguf", { allowLocalFile: true });
const { metadata } = (parsedGguf as GGUFParseOutput<{ strict: false }>); // custom metadata arch, no need for typing
expect(metadata['dummy.1']).toBeDefined(); // first metadata in the list
expect(metadata['dummy.32767']).toBeDefined(); // last metadata in the list
@ryan-the-crayon @ngxson merged and the new version of @huggingface/gguf.js
with the fix is released
When parsing a local GGUF and the metadata section does not fit in the same chunk, the parser would try to load more chunks. However, in the local file implementation range view, the chunk count is not incremented, resulting it not actually loading in more data.