Skip to content

gguf-py: byteswapping improvements #12851

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AlekseiNikiforovIBM
Copy link
Contributor

Implement byteswapping for Q4_0

This is needed to byteswap Mistral model.

Also restore original shapes after byteswapping tensors.
It is not needed at the moment, but do it in case they'd be used in future.

Rework byteswapping code in gguf-py: move out details from byteswapping tensor blocks code.

This is needed to byteswap Mistral model.

Also restore original shapes after byteswapping tensors.
It is not needed at the moment, but do it in case
they'd be used in future.
@github-actions github-actions bot added the python python script changes label Apr 9, 2025
Move out details from byteswapping tensor blocks code
@compilade
Copy link
Collaborator

I think it could be useful to add a byteswap method for all types in gguf-py/gguf/quants.py.

That would also be useful for GGUFWriter (and maybe also GGUFReader).

Then gguf_convert_endian.py could eventually simply be a read-write round trip with the desired endian set for GGUFWriter (while GGUFReader auto-detects the endianness of the source file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python python script changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants