Skip to content

gguf_hash.py: Add sha256 #8470

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 3 commits into from
Jul 14, 2024
Merged

Conversation

mofosyne
Copy link
Collaborator

@mofosyne mofosyne commented Jul 13, 2024

Found out that python hashlib that is already included in this repo has sha256 in addition to the sha1 we are already using for sha1 and uuid hash.

We have already implemented this in the C version of llama-gguf-hash so might as well include it in the python version.


Cross Checking gguf_hash.py with the C implementation llama-gguf-hash

$ ~/llama.cpp/gguf-py/scripts/gguf_hash.py Maykeye_Tinyllama-5M-v0.2-F16.gguf --no-layer
sha1      a9de42f2bbeee1eba49bc39b25cf69ff7a0937f6  Maykeye_Tinyllama-5M-v0.2-F16.gguf
sha256    8b3e00226cc2a55398b1ffbda7af8464040f9cd7b22ccbef8ba60b227924a2b1  Maykeye_Tinyllama-5M-v0.2-F16.gguf
uuid      86b1ebff-d754-50fc-9245-d23fe329817c  Maykeye_Tinyllama-5M-v0.2-F16.gguf

$ ~/llama.cpp/llama-gguf-hash --all --no-layer --uuid Maykeye_Tinyllama-5M-v0.2-F16.gguf
xxh64     cbd383cfd4c897e6  Maykeye_Tinyllama-5M-v0.2-F16.gguf
sha1      a9de42f2bbeee1eba49bc39b25cf69ff7a0937f6  Maykeye_Tinyllama-5M-v0.2-F16.gguf
sha256    8b3e00226cc2a55398b1ffbda7af8464040f9cd7b22ccbef8ba60b227924a2b1  Maykeye_Tinyllama-5M-v0.2-F16.gguf
uuid      86b1ebff-d754-50fc-9245-d23fe329817c  Maykeye_Tinyllama-5M-v0.2-F16.gguf

(side thought: Would it be worth having general.sha256 to have self validating gguf files... sounds interesting... but likely only makes sense in the context of cryptographic signing of tensor data... which will require more thought on standardizing the authenticity and verification of tensor weights as not being tampered with... and llama.cpp is a bit too new to do something like that in my opinion)

@github-actions github-actions bot added the python python script changes label Jul 13, 2024
@mofosyne mofosyne force-pushed the gguf-hash-py-add-sha256 branch from 7265315 to 77b0ca4 Compare July 13, 2024 14:30
@mofosyne mofosyne added the Review Complexity : Low Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix label Jul 13, 2024
@mofosyne mofosyne added the merge ready indicates that this may be ready to merge soon and is just holding out in case of objections label Jul 14, 2024
@mofosyne mofosyne merged commit e236528 into ggml-org:master Jul 14, 2024
8 checks passed
@mofosyne mofosyne deleted the gguf-hash-py-add-sha256 branch July 14, 2024 06:47
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Jul 27, 2024
* gguf_hash.py: Add sha256

* gguf_hash.py: rename string UUIDv5 --> uuid

* Apply suggestions from code review

Co-authored-by: compilade <[email protected]>

---------

Co-authored-by: compilade <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge ready indicates that this may be ready to merge soon and is just holding out in case of objections python python script changes Review Complexity : Low Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants