gguf-tools icon indicating copy to clipboard operation
gguf-tools copied to clipboard

Please add an API for readonly files

Open xnorai opened this issue 1 year ago • 2 comments

Currently gguf-tools (as used in e.g. MLX - a popular choice on Apple platforms) cannot open *.gguf files on iOS, if those gguf files are in the app bundle. The root cause is it always seems to open files in read/write mode, and then it also mmaps writable regions, both of which fail on iOS because bundled data is very much read-only by design. I imagine there could be other circumstances where read-only access is desirable.

It'd be great if there was a readonly mode for read-only access.

xnorai avatar Nov 15 '24 23:11 xnorai

Here's what I mean. This, obviously, is not a complete fix because it permanently switches things into read-only mode, which is not suitable for all circumstances. That is how we patched it for our own specific needs.

0001-Open-files-in-readonly-mode.patch

xnorai avatar Nov 16 '24 00:11 xnorai

Encountered the same issue with gguf_open when downloading models as one user, and then using it with container as different one. It would make sense to at least be able to choose mode of opening.

atobiszei avatar Nov 14 '25 14:11 atobiszei