ggufkit 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. ggufkit-0.1.0/.gitignore +171 -0
  2. ggufkit-0.1.0/CHANGELOG.md +56 -0
  3. ggufkit-0.1.0/CITATION.cff +23 -0
  4. ggufkit-0.1.0/LICENSE +22 -0
  5. ggufkit-0.1.0/PKG-INFO +417 -0
  6. ggufkit-0.1.0/README.md +383 -0
  7. ggufkit-0.1.0/SECURITY.md +37 -0
  8. ggufkit-0.1.0/docs/FINGERPRINT.md +168 -0
  9. ggufkit-0.1.0/docs/MANIFEST.md +159 -0
  10. ggufkit-0.1.0/docs/RELEASING.md +75 -0
  11. ggufkit-0.1.0/pyproject.toml +140 -0
  12. ggufkit-0.1.0/src/ggufkit/__init__.py +12 -0
  13. ggufkit-0.1.0/src/ggufkit/__main__.py +5 -0
  14. ggufkit-0.1.0/src/ggufkit/_util.py +75 -0
  15. ggufkit-0.1.0/src/ggufkit/canon.py +200 -0
  16. ggufkit-0.1.0/src/ggufkit/cli.py +80 -0
  17. ggufkit-0.1.0/src/ggufkit/dequant.py +70 -0
  18. ggufkit-0.1.0/src/ggufkit/diff.py +462 -0
  19. ggufkit-0.1.0/src/ggufkit/fingerprint.py +263 -0
  20. ggufkit-0.1.0/src/ggufkit/manifest.py +556 -0
  21. ggufkit-0.1.0/src/ggufkit/model.py +301 -0
  22. ggufkit-0.1.0/src/ggufkit/py.typed +0 -0
  23. ggufkit-0.1.0/src/ggufkit/stitch.py +163 -0
  24. ggufkit-0.1.0/src/ggufkit/verify.py +426 -0
  25. ggufkit-0.1.0/src/ggufkit/viz/__init__.py +28 -0
  26. ggufkit-0.1.0/src/ggufkit/viz/errmap.py +374 -0
  27. ggufkit-0.1.0/src/ggufkit/viz/layers.py +410 -0
  28. ggufkit-0.1.0/src/ggufkit/viz/palette.py +71 -0
  29. ggufkit-0.1.0/src/ggufkit/viz/render.py +408 -0
  30. ggufkit-0.1.0/tests/__init__.py +0 -0
  31. ggufkit-0.1.0/tests/conftest.py +187 -0
  32. ggufkit-0.1.0/tests/golden/tiny.json +59 -0
  33. ggufkit-0.1.0/tests/golden/weights.json +7 -0
  34. ggufkit-0.1.0/tests/test_canon.py +90 -0
  35. ggufkit-0.1.0/tests/test_cli.py +83 -0
  36. ggufkit-0.1.0/tests/test_diff.py +158 -0
  37. ggufkit-0.1.0/tests/test_fingerprint.py +175 -0
  38. ggufkit-0.1.0/tests/test_golden.py +73 -0
  39. ggufkit-0.1.0/tests/test_manifest.py +248 -0
  40. ggufkit-0.1.0/tests/test_model.py +52 -0
  41. ggufkit-0.1.0/tests/test_robustness.py +302 -0
  42. ggufkit-0.1.0/tests/test_stitch.py +54 -0
  43. ggufkit-0.1.0/tests/test_verify.py +238 -0
  44. ggufkit-0.1.0/tests/test_viz.py +171 -0
  45. ggufkit-0.1.0/tests/test_viz_error.py +188 -0
  46. ggufkit-0.1.0/tests/test_viz_layers.py +191 -0
@@ -0,0 +1,171 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
161
+
162
+ # ggufkit
163
+ *.gguf
164
+ *.manifest.json
165
+ /scratch/
166
+ .ruff_cache/
167
+ # Local signing runs (scripts/make_demos.py makes throwaway keys): never commit these.
168
+ *.key
169
+ *.sigstore.json
170
+ *.intoto.json
171
+ node_modules/
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
5
+ [semantic versioning](https://semver.org/).
6
+
7
+ ## [0.1.0] - 2026-10-27
8
+
9
+ First release. Supports Python 3.11 to 3.14.
10
+
11
+ ### Added
12
+
13
+ - `ggufkit fingerprint`: order-independent content fingerprint (`ggufkit-fp/1`, see
14
+ `docs/FINGERPRINT.md`) with separate digests for metadata, tensor descriptors and weights.
15
+ Invariant to metadata and tensor order, offsets, alignment, sharding and, for element types,
16
+ byte order. `weights` binds each tensor's bytes to its name, so data moved between tensors
17
+ is a change.
18
+ - `ggufkit manifest`: provenance record (`ggufkit-manifest/1`, see `docs/MANIFEST.md`) with the
19
+ fingerprint, file hashes, metadata claims, user-supplied build inputs and a provenance gap list.
20
+ - `ggufkit verify`: compare a model with a manifest or another file and get a one-word verdict
21
+ with a meaningful exit status. It passes only when the weights were actually compared (or
22
+ `--no-data` asks for a metadata-only check), and `--file-sha256` passes only when the
23
+ manifest recorded file hashes.
24
+ - `ggufkit diff`: metadata value diff, tensor diff and `--numeric` per-tensor error statistics.
25
+ - `ggufkit stitch`: combine the metadata of one file with the tensors of another, or write a
26
+ vocab-only file.
27
+ - `ggufkit viz tensor`: render tensors of any type `gguf.quants` can decode as images.
28
+ - Split models (`-00001-of-00003.gguf`) are handled as one model everywhere.
29
+ - `ggufkit viz error`: per-weight error heatmaps between two models' tensors (absolute,
30
+ relative or signed), pooled to a pixel budget while decoding, with a caption of rmse,
31
+ relative L2 and cosine similarity, and an optional shared colour scale.
32
+ - `ggufkit viz layers`: a grid of the quantization type of every tensor, block by block,
33
+ coloured by bits per weight; also as a text table or JSON.
34
+ - `ggufkit viz layers` takes several models and draws them side by side with one palette,
35
+ so a colour means the same type in every panel.
36
+ - README images and examples from a real model (Qwen3-0.6B, BF16, Q4_K_M and UD-Q4_K_XL from
37
+ unsloth/Qwen3-0.6B-GGUF), regenerated by `scripts/make_readme_assets.py` from a pinned
38
+ revision with sha256 checks. `scripts/make_examples.py` keeps one synthetic illustration.
39
+ - `ggufkit manifest --intoto FILE`: an in-toto Statement v1 for signing; `docs/MANIFEST.md`
40
+ has a cosign recipe tested on a real model.
41
+ - Malformed and hostile files fail fast with one `error:` line and exit status 2: a header
42
+ check rejects declared sizes that cannot fit in the file before gguf-py parses it. Output
43
+ files are written atomically, and existing ones are only replaced with `--force`.
44
+ - `python -m ggufkit`, and type information for the package (`py.typed`).
45
+ - README demo animations (`scripts/make_demos.py`, `scripts/demos/`), recorded from real
46
+ commands on the same files, with 1080x1920 and 4:5 MP4 renders and SRT captions for posting
47
+ elsewhere.
48
+ - Releases are built once, smoke-tested from a clean install, attested (build provenance and
49
+ PyPI attestations) and published by `.github/workflows/release.yml`.
50
+
51
+ ### Origins
52
+
53
+ Builds on [KerfuffleV2/gguf-tools](https://github.com/KerfuffleV2/gguf-tools) (MIT, 2023):
54
+ `gguf-checksum`, `gguf-frankenstein` and `gguf-tensor-to-image`, whose history is preserved.
55
+
56
+ [0.1.0]: https://github.com/MysterionRise/ggufkit/releases/tag/v0.1.0
@@ -0,0 +1,23 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use ggufkit in your work, please cite it as below."
3
+ title: "ggufkit: fingerprint, verify and visualize GGUF models"
4
+ type: software
5
+ authors:
6
+ - family-names: Perikov
7
+ given-names: Konstantin
8
+ - alias: KerfuffleV2
9
+ name: Kerfuffle
10
+ version: 0.1.0
11
+ date-released: "2026-10-27"
12
+ license: MIT
13
+ repository-code: "https://github.com/MysterionRise/ggufkit"
14
+ keywords:
15
+ - gguf
16
+ - llama.cpp
17
+ - quantization
18
+ - provenance
19
+ - model signing
20
+ abstract: >-
21
+ ggufkit gives GGUF model files an order-independent content fingerprint, a provenance
22
+ manifest that records what a file claims and what it leaves out, verification against either,
23
+ and images of quantization error and quantization recipes.
ggufkit-0.1.0/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Kerfuffle (original gguf-tools scripts)
4
+ Copyright (c) 2026 Konstantin Perikov (ggufkit)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.