Skip to content

Refactor gguf scripts to improve metadata handling #11909

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

Merged
merged 10 commits into from
Feb 26, 2025

Conversation

CISC
Copy link
Collaborator

@CISC CISC commented Feb 16, 2025

I've had these changes locally for quite a while and more or less forgotten about them, it's high time to make a PR as it fixes a few issues (endianess check) as well as improving and deduplicating metadata handling/rendering across all scripts.

  • Added contents method to ReaderField class
  • Added endianess property to GGUFReader class

Supercedes #11905

CISC added 3 commits February 16, 2025 13:44
Added contents method to ReaderField class
Added endianess property to GGUFReader class
@github-actions github-actions bot added the python python script changes label Feb 16, 2025
@ngxson ngxson requested a review from compilade February 16, 2025 15:06
Copy link
Collaborator

@compilade compilade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not test gguf_convert_endian or gguf_new_metadata, but I did test ReaderField.contents() in #11909 (comment) and gguf_dump, with both Numpy 1.26.4 and 2.2.0.

This is good and should finally completely fix #10127 even for big-endian models.

@ngxson
Copy link
Collaborator

ngxson commented Feb 22, 2025

@CISC Can you confirm if this is ready to be merged?

@CISC
Copy link
Collaborator Author

CISC commented Feb 22, 2025

@ngxson Yes, it's ready, @compilade will add tests in another PR.

@CISC
Copy link
Collaborator Author

CISC commented Feb 26, 2025

@ngxson Resolved conflict with #12081 mind merging now? :)

@compilade compilade merged commit 69050a1 into ggml-org:master Feb 26, 2025
4 checks passed
@CISC CISC deleted the gguf-py-contents branch February 26, 2025 13:08
@CISC
Copy link
Collaborator Author

CISC commented Feb 26, 2025

@compilade Thanks. :)

Remember to tag the new version, though maybe not before after your PR?

mglambda pushed a commit to mglambda/llama.cpp that referenced this pull request Mar 8, 2025
* Refactor gguf scripts to improve metadata handling

Added contents method to ReaderField class
Added endianess property to GGUFReader class

* update scripts

* fix import

* remove unused import

* attempt to work around flake and pyright errors

* second attempt

* give up, ignore type

* bump version

* apply newbyteorder fixes
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Mar 19, 2025
* Refactor gguf scripts to improve metadata handling

Added contents method to ReaderField class
Added endianess property to GGUFReader class

* update scripts

* fix import

* remove unused import

* attempt to work around flake and pyright errors

* second attempt

* give up, ignore type

* bump version

* apply newbyteorder fixes
mostlyuseful pushed a commit to mostlyuseful/llama.cpp that referenced this pull request May 12, 2025
* Refactor gguf scripts to improve metadata handling

Added contents method to ReaderField class
Added endianess property to GGUFReader class

* update scripts

* fix import

* remove unused import

* attempt to work around flake and pyright errors

* second attempt

* give up, ignore type

* bump version

* apply newbyteorder fixes
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.

3 participants