Skip to content

Refactor gguf scripts to improve metadata handling#11909

Merged
compilade merged 10 commits intoggml-org:masterfrom
CISC:gguf-py-contents
Feb 26, 2025
Merged

Refactor gguf scripts to improve metadata handling#11909
compilade merged 10 commits intoggml-org:masterfrom
CISC:gguf-py-contents

Conversation

@CISC
Copy link
Copy Markdown
Member

@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
Comment thread gguf-py/gguf/gguf_reader.py
Copy link
Copy Markdown
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
Copy Markdown
Contributor

ngxson commented Feb 22, 2025

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

@CISC
Copy link
Copy Markdown
Member Author

CISC commented Feb 22, 2025

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

@CISC
Copy link
Copy Markdown
Member 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
@CISC CISC deleted the gguf-py-contents branch February 26, 2025 13:08
@CISC
Copy link
Copy Markdown
Member Author

CISC commented Feb 26, 2025

@compilade Thanks. :)

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

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
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
* 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