glc-loader 1.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 (83) hide show
  1. glc_loader-1.1.0/LICENSE +202 -0
  2. glc_loader-1.1.0/MANIFEST.in +18 -0
  3. glc_loader-1.1.0/NOTICE +4 -0
  4. glc_loader-1.1.0/PKG-INFO +292 -0
  5. glc_loader-1.1.0/README.md +255 -0
  6. glc_loader-1.1.0/glc_loader/NOTICE +4 -0
  7. glc_loader-1.1.0/glc_loader/__init__.py +190 -0
  8. glc_loader-1.1.0/glc_loader/__main__.py +446 -0
  9. glc_loader-1.1.0/glc_loader/_inspect.py +786 -0
  10. glc_loader-1.1.0/glc_loader/artifact.py +517 -0
  11. glc_loader-1.1.0/glc_loader/container.py +378 -0
  12. glc_loader-1.1.0/glc_loader/loader.py +611 -0
  13. glc_loader-1.1.0/glc_loader/metal/__init__.py +25 -0
  14. glc_loader-1.1.0/glc_loader/metal/ple_gather_mlx.py +424 -0
  15. glc_loader-1.1.0/glc_loader/metal/tbe_backbone_batched_mlx.py +513 -0
  16. glc_loader-1.1.0/glc_loader/metal/tbe_decode_mlx.py +409 -0
  17. glc_loader-1.1.0/glc_loader/metal/tbe_decode_mlx_v2.py +245 -0
  18. glc_loader-1.1.0/glc_loader/metal/tbe_decode_mlx_v3.py +313 -0
  19. glc_loader-1.1.0/glc_loader/metal/tbe_decode_mlx_v4.py +174 -0
  20. glc_loader-1.1.0/glc_loader/metal/tbe_gemv_fused_lut_mlx.py +682 -0
  21. glc_loader-1.1.0/glc_loader/metal/tbe_gemv_fused_mlx.py +819 -0
  22. glc_loader-1.1.0/glc_loader/metal/tbe_linear_mlx.py +94 -0
  23. glc_loader-1.1.0/glc_loader/metal/tbe_linear_mlx_v2.py +62 -0
  24. glc_loader-1.1.0/glc_loader/metal/tbe_linear_mlx_v3.py +64 -0
  25. glc_loader-1.1.0/glc_loader/metal/tbe_linear_mlx_v4.py +73 -0
  26. glc_loader-1.1.0/glc_loader/metal/tbe_mlx_model.py +448 -0
  27. glc_loader-1.1.0/glc_loader/metal/tbe_moe_batched_mlx.py +565 -0
  28. glc_loader-1.1.0/glc_loader/modules.py +317 -0
  29. glc_loader-1.1.0/glc_loader/tbe_anyrank.py +116 -0
  30. glc_loader-1.1.0/glc_loader/tbe_artifact.py +824 -0
  31. glc_loader-1.1.0/glc_loader/tbe_container.py +446 -0
  32. glc_loader-1.1.0/glc_loader/tbe_device_map.py +447 -0
  33. glc_loader-1.1.0/glc_loader/tbe_gather.py +270 -0
  34. glc_loader-1.1.0/glc_loader/tbe_mma.py +475 -0
  35. glc_loader-1.1.0/glc_loader/tbe_mma_kernel.cu +704 -0
  36. glc_loader-1.1.0/glc_loader/tbe_mma_kernels.py +125 -0
  37. glc_loader-1.1.0/glc_loader/tbe_modules.py +401 -0
  38. glc_loader-1.1.0/glc_loader/tbe_serve_portable.py +181 -0
  39. glc_loader-1.1.0/glc_loader/tbe_serving.py +835 -0
  40. glc_loader-1.1.0/glc_loader/tbe_stream_loader.py +772 -0
  41. glc_loader-1.1.0/glc_loader.egg-info/PKG-INFO +292 -0
  42. glc_loader-1.1.0/glc_loader.egg-info/SOURCES.txt +81 -0
  43. glc_loader-1.1.0/glc_loader.egg-info/dependency_links.txt +1 -0
  44. glc_loader-1.1.0/glc_loader.egg-info/entry_points.txt +3 -0
  45. glc_loader-1.1.0/glc_loader.egg-info/not-zip-safe +1 -0
  46. glc_loader-1.1.0/glc_loader.egg-info/requires.txt +20 -0
  47. glc_loader-1.1.0/glc_loader.egg-info/top_level.txt +2 -0
  48. glc_loader-1.1.0/glc_serve/__init__.py +29 -0
  49. glc_loader-1.1.0/glc_serve/__main__.py +4 -0
  50. glc_loader-1.1.0/glc_serve/bench.py +713 -0
  51. glc_loader-1.1.0/glc_serve/bundle.py +756 -0
  52. glc_loader-1.1.0/glc_serve/engine.py +633 -0
  53. glc_loader-1.1.0/glc_serve/espec.py +352 -0
  54. glc_loader-1.1.0/glc_serve/fastdec.py +640 -0
  55. glc_loader-1.1.0/glc_serve/fastdec_kernels.cu +512 -0
  56. glc_loader-1.1.0/glc_serve/fastserve.py +409 -0
  57. glc_loader-1.1.0/glc_serve/gate.py +342 -0
  58. glc_loader-1.1.0/glc_serve/loader.py +708 -0
  59. glc_loader-1.1.0/glc_serve/memcap.py +137 -0
  60. glc_loader-1.1.0/glc_serve/miv_gemv.py +890 -0
  61. glc_loader-1.1.0/glc_serve/miv_tbe.py +396 -0
  62. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe.h +65 -0
  63. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe_api.cu +76 -0
  64. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe_kernels.cuh +497 -0
  65. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe_m1.cu +3 -0
  66. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe_m2.cu +3 -0
  67. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe_m3.cu +3 -0
  68. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe_m4.cu +3 -0
  69. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe_m5.cu +3 -0
  70. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe_m6.cu +3 -0
  71. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe_m7.cu +3 -0
  72. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe_m8.cu +3 -0
  73. glc_loader-1.1.0/glc_serve/miv_tbe_csrc/miv_tbe_torch.cpp +91 -0
  74. glc_loader-1.1.0/glc_serve/modules.py +535 -0
  75. glc_loader-1.1.0/glc_serve/mtp.py +337 -0
  76. glc_loader-1.1.0/glc_serve/pack.py +431 -0
  77. glc_loader-1.1.0/glc_serve/q8serve.py +494 -0
  78. glc_loader-1.1.0/glc_serve/server.py +500 -0
  79. glc_loader-1.1.0/glc_serve/tbe_desc.py +278 -0
  80. glc_loader-1.1.0/glc_serve/tunes/fastdec_sm120.json +133 -0
  81. glc_loader-1.1.0/glc_serve/vendor.py +76 -0
  82. glc_loader-1.1.0/pyproject.toml +103 -0
  83. glc_loader-1.1.0/setup.cfg +4 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Alibaba Cloud
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,18 @@
1
+ # The sdist must carry the package and nothing else. `release/` also holds
2
+ # built model artifacts (release/public-models-*, release/week1-*, ...) that
3
+ # are gigabytes each and are not part of this distribution.
4
+ include README.md
5
+ include pyproject.toml
6
+ recursive-include glc_loader *.py *.cu *.metal
7
+ recursive-include glc_serve *.py *.cu *.cuh *.cpp *.h *.json
8
+ global-exclude *.pyc
9
+ global-exclude .DS_Store
10
+ prune glc_loader/__pycache__
11
+ prune glc_loader/metal/__pycache__
12
+ prune glc_loader/_tbe_mma_build
13
+ prune glc_serve/__pycache__
14
+ prune public-models-20260719
15
+ prune qwen-certified-20260717
16
+ prune rung3-four-stage-20260719
17
+ prune week1-composed-artifact-20260718
18
+ prune week1-qwen-flagship-20260725
@@ -0,0 +1,4 @@
1
+ GeoRefine codec software
2
+ Copyright 2026 Tsotchke Corporation
3
+
4
+ This package is licensed under the Apache License, Version 2.0.
@@ -0,0 +1,292 @@
1
+ Metadata-Version: 2.1
2
+ Name: glc-loader
3
+ Version: 1.1.0
4
+ Summary: Read, verify and serve GLC-FWP1 and GLC-TBE compressed model artifacts without the repository that built them
5
+ Author: Tsotchke Corporation
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/Tsotchke-Corporation/GeoRefine
8
+ Project-URL: Model, https://huggingface.co/Tsotchke-Corporation/Qwen3.8-27B-GeoRefine-TBE
9
+ Keywords: compression,lossless,transformer,inference,vram
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ License-File: NOTICE
21
+ Requires-Dist: torch>=2.1.0
22
+ Requires-Dist: safetensors>=0.4.0
23
+ Requires-Dist: transformers>=4.56.0
24
+ Provides-Extra: cuda
25
+ Requires-Dist: triton>=2.1.0; extra == "cuda"
26
+ Requires-Dist: ninja>=1.11; extra == "cuda"
27
+ Provides-Extra: metal
28
+ Requires-Dist: mlx>=0.26.0; extra == "metal"
29
+ Requires-Dist: mlx-lm>=0.26.0; extra == "metal"
30
+ Provides-Extra: qwen38
31
+ Requires-Dist: transformers>=5.13.0; extra == "qwen38"
32
+ Requires-Dist: huggingface_hub>=0.30.0; extra == "qwen38"
33
+ Requires-Dist: pillow>=10.0; extra == "qwen38"
34
+ Requires-Dist: torchvision>=0.26.0; extra == "qwen38"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
37
+
38
+ # glc-loader
39
+
40
+ Read, verify and serve GLC compressed model artifacts — with no checkout of
41
+ the repository that built them.
42
+
43
+ The compression is **bit-exact**: the weights this package hands back are the
44
+ same bytes the source checkpoint had, and `glc-loader verify --deep` proves
45
+ that on your machine, from the artifact alone. Runtime speed depends on the
46
+ backend and hardware; see [Hardware reality](#hardware-reality).
47
+
48
+ ---
49
+
50
+ ## Install
51
+
52
+ ```bash
53
+ pip install glc-loader
54
+ ```
55
+
56
+ That is enough to inspect, verify, expand and CPU-load any artifact. Two
57
+ optional extras add accelerated serving; **neither is required to import the
58
+ package**, and neither is a dependency of the other:
59
+
60
+ ```bash
61
+ pip install "glc-loader[cuda]" # + triton and Ninja for CUDA JIT backends
62
+ pip install "glc-loader[metal]" # + mlx, mlx-lm, for Apple Silicon
63
+ pip install "glc-loader[qwen38]" # Qwen3.8 multimodal runtime and processor
64
+ ```
65
+
66
+ Requires Python ≥ 3.10, `torch` ≥ 2.1, `safetensors` ≥ 0.4, `transformers`
67
+ ≥ 4.56.
68
+
69
+ *Tested against* torch 2.6.0, safetensors 0.8.0, transformers 5.13.0 on
70
+ macOS/arm64, Python 3.11. The version floors above are **declared**, not
71
+ measured — they are the lowest releases whose APIs this code uses, not the
72
+ lowest that have been run.
73
+
74
+ ---
75
+
76
+ ## The three commands
77
+
78
+ ### `glc-loader info <artifact-dir>`
79
+
80
+ What the artifact is, where it came from, its ratios **at all three scopes**,
81
+ and — the part that usually goes missing — what it does **not** certify.
82
+
83
+ ```bash
84
+ glc-loader info ./my-artifact
85
+ ```
86
+
87
+ Ratios come back as three separate blocks, each with its own `basis` string
88
+ and a `status` of `measured` or `unmeasured`. A scope this artifact does not
89
+ carry comes back `null`. It is never filled in from another scope:
90
+
91
+ | scope | what it counts |
92
+ |---|---|
93
+ | `stored` | bytes on disk |
94
+ | `served_resident` | bytes the device holds for weights |
95
+ | `whole_process` | measured peak process VRAM, dense vs coded — the only one that includes activations, the KV cache and allocator slack |
96
+
97
+ `whole_process` is normally `unmeasured`. The transcode step leaves it blank
98
+ by construction; it is filled only by a certify run on the target card. If
99
+ `info` tells you it is unmeasured, that is the truth, not a gap in the tool.
100
+
101
+ ### `glc-loader verify <artifact-dir>`
102
+
103
+ Integrity, with exit codes you can put in CI:
104
+
105
+ | exit | meaning |
106
+ |---|---|
107
+ | 0 | verified |
108
+ | 1 | an integrity check **failed** — a digest or a decoded tensor did not match |
109
+ | 2 | malformed, unreadable, or not a GeoRefine container at all |
110
+ | 3 | verified bit-exact, but the artifact **expands** (stores more bytes than the dense weights it replaces) |
111
+ | 4 | the format is recognised but this directory **cannot be verified from what it ships** |
112
+
113
+ ```bash
114
+ glc-loader verify ./my-artifact # digests
115
+ glc-loader verify ./my-artifact --deep # + decode every container
116
+ ```
117
+
118
+ Without `--deep` this checks digests only, and says so in the output. With
119
+ `--deep` it decodes every stored container and checks the result against the
120
+ source digest recorded before encoding — an end-to-end proof, reproducible on
121
+ your machine, that the bytes this artifact produces are the bytes the source
122
+ model had.
123
+
124
+ **Exit 4 is deliberate.** A `glc_tbe_transcode` v1 directory is a correct
125
+ artifact with no self-contained verifier: it ships a manifest and two tensor
126
+ blobs, and nothing binds the manifest to the blobs, so checking one against
127
+ the other would be checking the manifest against itself. Reporting that as
128
+ exit 2 ("malformed") would be a lie about a well-formed artifact, and
129
+ reporting it as 0 would be a lie about what was checked.
130
+
131
+ ### `glc-loader load <artifact-dir>`
132
+
133
+ Smoke-load the artifact, generate a few tokens, print the serving receipt.
134
+
135
+ ```bash
136
+ glc-loader load ./my-artifact --device cuda --prompt "The capital of France is"
137
+ ```
138
+
139
+ This is a smoke test, not a benchmark. The `tokens_per_second` it prints is
140
+ one greedy run on whatever device you gave it.
141
+
142
+ Two more commands exist for `GLC-RELEASE/1` artifacts specifically:
143
+ `glc-loader expand --out ./dense` writes a plain Hugging Face checkpoint for
144
+ any other engine, and `glc-loader generate --prompt ...` is the older,
145
+ more configurable generation path.
146
+
147
+ ---
148
+
149
+ ## From Python
150
+
151
+ ```python
152
+ from glc_loader import load_model
153
+
154
+ model, tokenizer, receipt = load_model("./my-artifact", device="cuda")
155
+ print(receipt["backend"])
156
+ ```
157
+
158
+ For a `georefine.tbe.v2` container:
159
+
160
+ ```python
161
+ from glc_loader import load_standalone, single_device_map
162
+
163
+ model, tokenizer, receipt = load_standalone(
164
+ "./my-artifact", device_map=single_device_map("cuda:0"),
165
+ )
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Hardware reality
171
+
172
+ ### Qwen3.8-27B serve-v1 compatibility prototype
173
+
174
+ The `georefine.tbe.serve.v1` bundle has a source-free compressed PyTorch path:
175
+
176
+ ```python
177
+ from glc_loader import load_compressed_transformers
178
+
179
+ model = load_compressed_transformers(
180
+ "Tsotchke-Corporation/Qwen3.8-27B-GeoRefine-TBE",
181
+ expect_manifest_sha256="10028416e07c802b47e4dc93a86e9f0dd35ce6021f0e07b96c70bd9cb7a72bc3",
182
+ )
183
+ ```
184
+
185
+ Install `glc-loader[qwen38]` for the required Qwen Transformers class and Hub
186
+ download support. The bundle remains encoded in safetensors arrays (`planes`,
187
+ `smb`, `esc`, `sbbase`). `PortableTBELinear` decodes one weight transiently per
188
+ call, performs a PyTorch linear operation, and discards the dense weight. This
189
+ is a correctness and portability fallback, **not** the measured fused-kernel
190
+ speed path. The base Qwen model's 1,184 tensors map exactly to the manifest;
191
+ the remaining 15 MTP weights are retained for native speculative inference.
192
+ The full 27B graph loaded on Linux CPU and produced finite text and minimal
193
+ image logits while retaining encoded weights. Full generation on this CPU
194
+ reference path is unverified, and its forward speed is not a serving claim.
195
+
196
+ **Decode speed is a property of the engine, not of the format.** The same
197
+ GLC-TBE weights have been measured on two decode paths:
198
+
199
+ | decode path | card | measured scope |
200
+ |---|---|---|
201
+ | portable PyTorch reference | Linux CPU | full 27B text/image forwards passed; too slow for serving |
202
+ | standard `glc-serve` HTTP, exact | Blackwell RTX PRO 6000 | 7.99 vs dense 17.50 tok/s end to end; 8/8 text + image parity |
203
+ | standard `glc-serve` HTTP, fused | Blackwell RTX PRO 6000 | 14.95 vs dense 17.50 tok/s; 5/8 text parity |
204
+ | `FastSession` whole-step CUDA graph, **bundled SM120 tune** | Blackwell RTX PRO 6000 | **37.880 vs dense 28.288 decode tok/s (1.339×)**; 8/8 text token-ID + image parity |
205
+
206
+ The standard HTTP and `FastSession` rows use eight fixed greedy prompts and
207
+ one synthetic image on one card. The `FastSession` result was reproduced from
208
+ an installed wheel and its packaged tune; it is not a cross-platform speed
209
+ guarantee or a general capability certificate.
210
+
211
+ Earlier standalone-loader measurements were **0.94×** dense on RTX PRO and
212
+ **0.57–0.62×** on A100. Those were single runs with roughly ±0.05 spread on a
213
+ different decode path; they do not measure the packaged `FastSession` engine.
214
+
215
+ The engine row is Qwen3.8-27B, TBE bundle, batch 1, greedy AR on one card
216
+ (receipts in `KERNEL_SPEED_20260925.md`): **37.84 tok/s**, against 28.29 tok/s
217
+ for the bf16 parent in the same engine and 27.4–27.6 tok/s for llama.cpp bf16
218
+ (tg128) on the same card. Peak VRAM (NVML) was 49.9–50.0 GB, against
219
+ 65.4–72.8 GB for the dense engine. The engine's output is bitwise equal to the
220
+ bf16 parent on its gate probes (G3a 711/711 rows).
221
+
222
+ Memory is the saving that holds on every path. For orientation, one real
223
+ artifact (`unsloth/Llama-3.2-1B-Instruct`, GLC-FWP1) reports a weight ratio of
224
+ **1.279×** at the served-graph scope — 1.93 GB resident where the dense
225
+ checkpoint needs 2.47 GB. Your artifact's own numbers are in
226
+ `glc-loader info`; do not carry that one across.
227
+
228
+ On the tested RTX PRO 6000, choose `FastSession` for the measured fast path.
229
+ The standard HTTP route and portable CPU path have different speed contracts.
230
+
231
+ ```python
232
+ from huggingface_hub import snapshot_download
233
+ from glc_serve.fastserve import FastSession
234
+
235
+ bundle = snapshot_download("Tsotchke-Corporation/Qwen3.8-27B-GeoRefine-TBE")
236
+ session = FastSession.load(
237
+ bundle=bundle, tune=None, # bundled tune: RTX PRO 6000 Blackwell only
238
+ server_flags=["--gate", "full", "--manifest-sha256",
239
+ "10028416e07c802b47e4dc93a86e9f0dd35ce6021f0e07b96c70bd9cb7a72bc3"],
240
+ )
241
+ state = session.prefill(messages=[{"role": "user", "content": "Hello"}])
242
+ ids = list(session.generate(state, max_tokens=48, temperature=0.0))
243
+ print(session.tokenizer.decode(ids, skip_special_tokens=True))
244
+ ```
245
+
246
+ The public Hugging Face manifest hash above differs from the internal GCS
247
+ source manifest because private build paths were removed. Allow room for the
248
+ 40 GB bundle and about 50 GB peak GPU memory on the measured SM120 path. An
249
+ RTX PRO 6000 is the only card whose tune and full-model speed have been
250
+ verified in this wheel; other devices need an explicit tune and separate
251
+ correctness and performance measurements.
252
+
253
+ ---
254
+
255
+ ## CUDA package scope
256
+
257
+ This wheel includes the TBE MMA source (`tbe_mma_kernel.cu`), `FastDecoder` and MIV-TBE CUDA
258
+ sources, plus the measured RTX PRO 6000 SM120 tune. They JIT-build in a user
259
+ cache; a CUDA toolkit, C++ compiler, Python headers and Ninja are required.
260
+ `FastSession.load` selects the bundled tune only on the measured SM120 card.
261
+ Other GPUs require an explicit tune and their own exactness and speed tests.
262
+ The experimental FWP1 Triton source is still artifact-local (`fwp1_kernels.py`) and is not in
263
+ this wheel; that optional backend refuses or uses its documented fallback.
264
+
265
+ ---
266
+
267
+ ## Which formats this reads
268
+
269
+ | format | self-contained? | `verify` | `load` |
270
+ |---|---|---|---|
271
+ | `GLC-RELEASE/1` (FWP1) | yes | digests, and `--deep` bit-exactness | yes |
272
+ | `georefine.tbe.v2` | yes | `SHA256SUMS`, and `--deep` bit-exactness | yes, on a supported device |
273
+ | `glc_tbe_transcode` v1 | **no** — no config, no tokenizer, no format tag | exit 4, with the reason | refused |
274
+ | anything else | — | exit 2 | refused |
275
+
276
+ Format is decided by a **declared tag** — `MANIFEST.json`'s `"format"`, or
277
+ `compression_info.json`'s `"artifact_format"` — never by which files happen to
278
+ be on disk. A plain Hugging Face checkpoint ships `config.json` and
279
+ `model.safetensors`, and a loader that inferred "container" from those would
280
+ claim every model on the hub. Point this at an ordinary checkpoint and it
281
+ declines, by design.
282
+
283
+ ---
284
+
285
+ ## Licence
286
+
287
+ The compressed weights inherit the **source model's** licence. `glc-loader
288
+ info` reports whatever licence the artifact declares or ships, and reports
289
+ `null` with a note when it declares none — which is the common case today.
290
+ Check the source model before redistributing.
291
+
292
+ This package is proprietary to Tsotchke Corporation.