comfyui-orbitquant 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,12 @@
1
+ """ComfyUI custom nodes for OrbitQuant artifacts."""
2
+
3
+ from comfyui_orbitquant.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
4
+
5
+
6
+ async def comfy_entrypoint():
7
+ from comfyui_orbitquant.v3 import comfy_entrypoint as v3_entrypoint
8
+
9
+ return await v3_entrypoint()
10
+
11
+
12
+ __all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "comfy_entrypoint"]
@@ -0,0 +1,325 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from pathlib import Path
5
+ from typing import Any
6
+
7
+ RUNTIME_MODE_OPTIONS = (
8
+ "auto_fused",
9
+ "dequant_bf16",
10
+ "debug_no_quant",
11
+ "debug_no_activation_quant",
12
+ "triton_packed_matmul",
13
+ "native_packed_matmul",
14
+ )
15
+
16
+ ACTIVATION_KERNEL_BACKEND_OPTIONS = ("auto", "cpu", "mps", "triton_cuda")
17
+
18
+
19
+ def _missing_orbitquant_error() -> RuntimeError:
20
+ return RuntimeError(
21
+ "ComfyUI-OrbitQuant requires the orbitquant package. Install OrbitQuant "
22
+ "into the Python environment used by ComfyUI before using this node."
23
+ )
24
+
25
+
26
+ def _orbitquant_manifest_cls() -> Any:
27
+ try:
28
+ from orbitquant.artifacts import OrbitQuantManifest
29
+ except ImportError as exc:
30
+ raise _missing_orbitquant_error() from exc
31
+ return OrbitQuantManifest
32
+
33
+
34
+ def validate_orbitquant_artifact(artifact_path: str | Path) -> dict[str, Any]:
35
+ try:
36
+ from orbitquant.artifacts import validate_orbitquant_artifact as validate
37
+ except ImportError as exc:
38
+ raise _missing_orbitquant_error() from exc
39
+ return validate(artifact_path)
40
+
41
+
42
+ def load_quantized_pipeline_component(
43
+ pipeline: Any,
44
+ artifact_path: str | Path,
45
+ *,
46
+ component: str,
47
+ strict: bool,
48
+ runtime_mode: str | None = None,
49
+ activation_kernel_backend: str | None = None,
50
+ ) -> Any:
51
+ try:
52
+ from orbitquant.pipeline import load_quantized_pipeline_component as load_component
53
+ except ImportError as exc:
54
+ raise _missing_orbitquant_error() from exc
55
+ return load_component(
56
+ pipeline,
57
+ artifact_path,
58
+ component=component,
59
+ strict=strict,
60
+ runtime_mode=runtime_mode,
61
+ activation_kernel_backend=activation_kernel_backend,
62
+ )
63
+
64
+
65
+ def _validate_runtime_options(runtime_mode: str, activation_kernel_backend: str) -> None:
66
+ if runtime_mode not in RUNTIME_MODE_OPTIONS:
67
+ accepted = ", ".join(RUNTIME_MODE_OPTIONS)
68
+ raise ValueError(f"runtime_mode must be one of [{accepted}], got {runtime_mode!r}")
69
+ if activation_kernel_backend not in ACTIVATION_KERNEL_BACKEND_OPTIONS:
70
+ accepted = ", ".join(ACTIVATION_KERNEL_BACKEND_OPTIONS)
71
+ raise ValueError(
72
+ "activation_kernel_backend must be one of "
73
+ f"[{accepted}], got {activation_kernel_backend!r}"
74
+ )
75
+
76
+
77
+ def read_manifest(artifact_path: str | Path) -> Any:
78
+ path = Path(artifact_path)
79
+ return _orbitquant_manifest_cls().from_dict(
80
+ json.loads((path / "orbitquant_manifest.json").read_text(encoding="utf-8"))
81
+ )
82
+
83
+
84
+ def read_model_index(artifact_path: str | Path) -> dict[str, Any]:
85
+ path = Path(artifact_path) / "model_index.json"
86
+ if not path.is_file():
87
+ return {}
88
+ return json.loads(path.read_text(encoding="utf-8"))
89
+
90
+
91
+ def _manifest_payload(manifest: Any) -> dict[str, Any]:
92
+ quantized_modules = list(getattr(manifest, "quantized_modules", []))
93
+ adaln_modules = list(getattr(manifest, "adaln_modules", []))
94
+ skipped_modules = list(getattr(manifest, "skipped_modules", []))
95
+ return {
96
+ "source_model_id": manifest.source_model_id,
97
+ "source_revision": getattr(manifest, "source_revision", "unknown"),
98
+ "source_license": getattr(manifest, "source_license", "unknown"),
99
+ "bits": f"W{manifest.weight_bits}A{manifest.activation_bits}",
100
+ "target_policy": getattr(manifest, "target_policy", "unknown"),
101
+ "runtime_mode": getattr(manifest, "runtime_mode", "unknown"),
102
+ "activation_kernel_backend": getattr(manifest, "activation_kernel_backend", "auto"),
103
+ "quantized_module_count": len(quantized_modules),
104
+ "adaln_module_count": len(adaln_modules),
105
+ "skipped_module_count": len(skipped_modules),
106
+ "quantized_modules": quantized_modules,
107
+ "adaln_modules": adaln_modules,
108
+ "skipped_modules": skipped_modules,
109
+ }
110
+
111
+
112
+ def _payload_with_model_index(manifest: Any, artifact_path: str | Path) -> dict[str, Any]:
113
+ payload = _manifest_payload(manifest)
114
+ model_index = read_model_index(artifact_path)
115
+ if model_index:
116
+ payload["artifact_component"] = model_index.get("component", "unknown")
117
+ payload["artifact_weight_name"] = model_index.get("weight_name", "unknown")
118
+ return payload
119
+
120
+
121
+ def _summary_text(payload: dict[str, Any]) -> str:
122
+ lines = [
123
+ f"Source: {payload['source_model_id']}",
124
+ f"Revision: {payload['source_revision']}",
125
+ f"Bits: {payload['bits']}",
126
+ ]
127
+ if "artifact_component" in payload:
128
+ lines.append(f"Component: {payload['artifact_component']}")
129
+ lines.extend(
130
+ [
131
+ f"Policy: {payload['target_policy']}",
132
+ f"Runtime: {payload['runtime_mode']}",
133
+ f"Activation backend: {payload['activation_kernel_backend']}",
134
+ f"Quantized modules: {payload['quantized_module_count']}",
135
+ f"AdaLN INT4 modules: {payload['adaln_module_count']}",
136
+ f"Skipped modules: {payload['skipped_module_count']}",
137
+ ]
138
+ )
139
+ return "\n".join(lines)
140
+
141
+
142
+ class OrbitQuantArtifactInspector:
143
+ @classmethod
144
+ def INPUT_TYPES(cls):
145
+ return {
146
+ "required": {
147
+ "artifact_path": (
148
+ "STRING",
149
+ {"default": "", "multiline": False},
150
+ )
151
+ }
152
+ }
153
+
154
+ RETURN_TYPES = ("STRING", "ORBITQUANT_INFO")
155
+ RETURN_NAMES = ("summary", "info")
156
+ FUNCTION = "inspect"
157
+ CATEGORY = "OrbitQuant"
158
+
159
+ def inspect(self, artifact_path: str):
160
+ if not artifact_path:
161
+ raise ValueError("artifact_path must not be empty")
162
+ path = Path(artifact_path)
163
+ manifest = read_manifest(path)
164
+ validation = validate_orbitquant_artifact(path)
165
+ payload = _payload_with_model_index(manifest, path)
166
+ payload.update(validation)
167
+ return (_summary_text(payload), payload)
168
+
169
+
170
+ class OrbitQuantPipelineComponentLoader:
171
+ @classmethod
172
+ def INPUT_TYPES(cls):
173
+ return {
174
+ "required": {
175
+ "pipeline": ("PIPELINE", {"forceInput": True}),
176
+ "artifact_path": (
177
+ "STRING",
178
+ {"default": "", "multiline": False},
179
+ ),
180
+ "component": (
181
+ ["transformer", "model", "diffusion_model"],
182
+ {"default": "transformer"},
183
+ ),
184
+ "strict": ("BOOLEAN", {"default": True}),
185
+ "runtime_mode": (list(RUNTIME_MODE_OPTIONS), {"default": "auto_fused"}),
186
+ "activation_kernel_backend": (
187
+ list(ACTIVATION_KERNEL_BACKEND_OPTIONS),
188
+ {"default": "auto"},
189
+ ),
190
+ }
191
+ }
192
+
193
+ RETURN_TYPES = ("PIPELINE", "ORBITQUANT_INFO")
194
+ RETURN_NAMES = ("pipeline", "info")
195
+ FUNCTION = "load"
196
+ CATEGORY = "OrbitQuant"
197
+
198
+ def load(
199
+ self,
200
+ pipeline: Any,
201
+ artifact_path: str,
202
+ component: str,
203
+ strict: bool,
204
+ runtime_mode: str = "auto_fused",
205
+ activation_kernel_backend: str = "auto",
206
+ ):
207
+ if not artifact_path:
208
+ raise ValueError("artifact_path must not be empty")
209
+ _validate_runtime_options(runtime_mode, activation_kernel_backend)
210
+ manifest = load_quantized_pipeline_component(
211
+ pipeline,
212
+ artifact_path,
213
+ component=component,
214
+ strict=bool(strict),
215
+ runtime_mode=runtime_mode,
216
+ activation_kernel_backend=activation_kernel_backend,
217
+ )
218
+ payload = _payload_with_model_index(manifest, artifact_path)
219
+ payload["requested_runtime_mode"] = runtime_mode
220
+ payload["requested_activation_kernel_backend"] = activation_kernel_backend
221
+ return (pipeline, payload)
222
+
223
+
224
+ class _OrbitQuantTransformerLoader:
225
+ loader_target = "generic"
226
+ display_name = "OrbitQuant Transformer Loader"
227
+ accepted_target_policies: tuple[str, ...] = ()
228
+
229
+ @classmethod
230
+ def INPUT_TYPES(cls):
231
+ return {
232
+ "required": {
233
+ "pipeline": ("PIPELINE", {"forceInput": True}),
234
+ "artifact_path": (
235
+ "STRING",
236
+ {"default": "", "multiline": False},
237
+ ),
238
+ "strict": ("BOOLEAN", {"default": True}),
239
+ "runtime_mode": (list(RUNTIME_MODE_OPTIONS), {"default": "auto_fused"}),
240
+ "activation_kernel_backend": (
241
+ list(ACTIVATION_KERNEL_BACKEND_OPTIONS),
242
+ {"default": "auto"},
243
+ ),
244
+ }
245
+ }
246
+
247
+ RETURN_TYPES = ("PIPELINE", "ORBITQUANT_INFO")
248
+ RETURN_NAMES = ("pipeline", "info")
249
+ FUNCTION = "load"
250
+ CATEGORY = "OrbitQuant"
251
+
252
+ def load(
253
+ self,
254
+ pipeline: Any,
255
+ artifact_path: str,
256
+ strict: bool,
257
+ runtime_mode: str = "auto_fused",
258
+ activation_kernel_backend: str = "auto",
259
+ ):
260
+ if not artifact_path:
261
+ raise ValueError("artifact_path must not be empty")
262
+ _validate_runtime_options(runtime_mode, activation_kernel_backend)
263
+ preflight_payload = _payload_with_model_index(read_manifest(artifact_path), artifact_path)
264
+ self._validate_target_policy(preflight_payload)
265
+ manifest = load_quantized_pipeline_component(
266
+ pipeline,
267
+ artifact_path,
268
+ component="transformer",
269
+ strict=bool(strict),
270
+ runtime_mode=runtime_mode,
271
+ activation_kernel_backend=activation_kernel_backend,
272
+ )
273
+ payload = _payload_with_model_index(manifest, artifact_path)
274
+ self._validate_target_policy(payload)
275
+ payload["loader_target"] = self.loader_target
276
+ payload["requested_runtime_mode"] = runtime_mode
277
+ payload["requested_activation_kernel_backend"] = activation_kernel_backend
278
+ return (pipeline, payload)
279
+
280
+ def _validate_target_policy(self, payload: dict[str, Any]) -> None:
281
+ if not self.accepted_target_policies:
282
+ return
283
+ target_policy = payload.get("target_policy")
284
+ if target_policy in self.accepted_target_policies:
285
+ return
286
+ accepted = ", ".join(self.accepted_target_policies)
287
+ raise ValueError(
288
+ f"{self.display_name} expected an artifact with target_policy in "
289
+ f"[{accepted}], got {target_policy!r} from {payload.get('source_model_id')!r}."
290
+ )
291
+
292
+
293
+ class OrbitQuantFluxLoader(_OrbitQuantTransformerLoader):
294
+ loader_target = "flux"
295
+ display_name = "OrbitQuant FLUX Loader"
296
+ accepted_target_policies = ("flux", "flux2")
297
+
298
+
299
+ class OrbitQuantZImageLoader(_OrbitQuantTransformerLoader):
300
+ loader_target = "z_image"
301
+ display_name = "OrbitQuant Z-Image Loader"
302
+ accepted_target_policies = ("z_image",)
303
+
304
+
305
+ class OrbitQuantWanLoader(_OrbitQuantTransformerLoader):
306
+ loader_target = "wan"
307
+ display_name = "OrbitQuant Wan Loader"
308
+ accepted_target_policies = ("wan",)
309
+
310
+
311
+ NODE_CLASS_MAPPINGS = {
312
+ "OrbitQuantArtifactInspector": OrbitQuantArtifactInspector,
313
+ "OrbitQuantPipelineComponentLoader": OrbitQuantPipelineComponentLoader,
314
+ "OrbitQuantFluxLoader": OrbitQuantFluxLoader,
315
+ "OrbitQuantZImageLoader": OrbitQuantZImageLoader,
316
+ "OrbitQuantWanLoader": OrbitQuantWanLoader,
317
+ }
318
+
319
+ NODE_DISPLAY_NAME_MAPPINGS = {
320
+ "OrbitQuantArtifactInspector": "OrbitQuant Inspect Artifact",
321
+ "OrbitQuantPipelineComponentLoader": "OrbitQuant Pipeline Component Loader",
322
+ "OrbitQuantFluxLoader": "OrbitQuant FLUX Loader",
323
+ "OrbitQuantZImageLoader": "OrbitQuant Z-Image Loader",
324
+ "OrbitQuantWanLoader": "OrbitQuant Wan Loader",
325
+ }
@@ -0,0 +1,212 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from comfyui_orbitquant import nodes
6
+
7
+ try:
8
+ from comfy_api.latest import ComfyExtension, io
9
+ except Exception as exc: # pragma: no cover - exercised through lazy import tests.
10
+ raise ImportError("ComfyUI V3 API is not available") from exc
11
+
12
+
13
+ _CATEGORY = "OrbitQuant"
14
+ _INFO_TYPE = "ORBITQUANT_INFO"
15
+ _PIPELINE_TYPE = "PIPELINE"
16
+
17
+
18
+ def _pipeline_input() -> Any:
19
+ return io.Custom(_PIPELINE_TYPE).Input("pipeline", force_input=True)
20
+
21
+
22
+ def _pipeline_output() -> Any:
23
+ return io.Custom(_PIPELINE_TYPE).Output(display_name="pipeline")
24
+
25
+
26
+ def _info_output() -> Any:
27
+ return io.Custom(_INFO_TYPE).Output(display_name="info")
28
+
29
+
30
+ def _artifact_path_input() -> Any:
31
+ return io.String.Input(
32
+ "artifact_path",
33
+ default="",
34
+ multiline=False,
35
+ tooltip="Path to an OrbitQuant component artifact directory.",
36
+ )
37
+
38
+
39
+ def _strict_input() -> Any:
40
+ return io.Boolean.Input(
41
+ "strict",
42
+ default=True,
43
+ tooltip="Use strict OrbitQuant artifact state-dict loading.",
44
+ )
45
+
46
+
47
+ def _runtime_mode_input() -> Any:
48
+ return io.Combo.Input(
49
+ "runtime_mode",
50
+ options=list(nodes.RUNTIME_MODE_OPTIONS),
51
+ default="auto_fused",
52
+ tooltip="OrbitQuant runtime mode used when loading the artifact.",
53
+ )
54
+
55
+
56
+ def _activation_kernel_backend_input() -> Any:
57
+ return io.Combo.Input(
58
+ "activation_kernel_backend",
59
+ options=list(nodes.ACTIVATION_KERNEL_BACKEND_OPTIONS),
60
+ default="auto",
61
+ tooltip="Activation quantization kernel backend requested from OrbitQuant.",
62
+ )
63
+
64
+
65
+ class OrbitQuantArtifactInspectorV3(io.ComfyNode):
66
+ @classmethod
67
+ def define_schema(cls) -> io.Schema:
68
+ return io.Schema(
69
+ node_id="OrbitQuantArtifactInspector",
70
+ display_name="OrbitQuant Inspect Artifact",
71
+ category=_CATEGORY,
72
+ description="Validate an OrbitQuant artifact and summarize its metadata.",
73
+ inputs=[_artifact_path_input()],
74
+ outputs=[
75
+ io.String.Output(display_name="summary"),
76
+ _info_output(),
77
+ ],
78
+ )
79
+
80
+ @classmethod
81
+ def execute(cls, artifact_path: str) -> io.NodeOutput:
82
+ summary, info = nodes.OrbitQuantArtifactInspector().inspect(artifact_path)
83
+ return io.NodeOutput(summary, info)
84
+
85
+
86
+ class OrbitQuantPipelineComponentLoaderV3(io.ComfyNode):
87
+ @classmethod
88
+ def define_schema(cls) -> io.Schema:
89
+ return io.Schema(
90
+ node_id="OrbitQuantPipelineComponentLoader",
91
+ display_name="OrbitQuant Pipeline Component Loader",
92
+ category=_CATEGORY,
93
+ description="Attach an OrbitQuant component artifact to a pipeline object.",
94
+ inputs=[
95
+ _pipeline_input(),
96
+ _artifact_path_input(),
97
+ io.Combo.Input(
98
+ "component",
99
+ options=["transformer", "model", "diffusion_model"],
100
+ default="transformer",
101
+ tooltip="Pipeline attribute that receives the quantized component.",
102
+ ),
103
+ _strict_input(),
104
+ _runtime_mode_input(),
105
+ _activation_kernel_backend_input(),
106
+ ],
107
+ outputs=[
108
+ _pipeline_output(),
109
+ _info_output(),
110
+ ],
111
+ )
112
+
113
+ @classmethod
114
+ def execute(
115
+ cls,
116
+ pipeline: Any,
117
+ artifact_path: str,
118
+ component: str,
119
+ strict: bool,
120
+ runtime_mode: str,
121
+ activation_kernel_backend: str,
122
+ ) -> io.NodeOutput:
123
+ loaded_pipeline, info = nodes.OrbitQuantPipelineComponentLoader().load(
124
+ pipeline,
125
+ artifact_path,
126
+ component,
127
+ strict,
128
+ runtime_mode,
129
+ activation_kernel_backend,
130
+ )
131
+ return io.NodeOutput(loaded_pipeline, info)
132
+
133
+
134
+ class _OrbitQuantTransformerLoaderV3(io.ComfyNode):
135
+ legacy_loader_cls: type[nodes._OrbitQuantTransformerLoader]
136
+ node_id: str
137
+ display_name: str
138
+ description: str
139
+
140
+ @classmethod
141
+ def define_schema(cls) -> io.Schema:
142
+ return io.Schema(
143
+ node_id=cls.node_id,
144
+ display_name=cls.display_name,
145
+ category=_CATEGORY,
146
+ description=cls.description,
147
+ inputs=[
148
+ _pipeline_input(),
149
+ _artifact_path_input(),
150
+ _strict_input(),
151
+ _runtime_mode_input(),
152
+ _activation_kernel_backend_input(),
153
+ ],
154
+ outputs=[
155
+ _pipeline_output(),
156
+ _info_output(),
157
+ ],
158
+ )
159
+
160
+ @classmethod
161
+ def execute(
162
+ cls,
163
+ pipeline: Any,
164
+ artifact_path: str,
165
+ strict: bool,
166
+ runtime_mode: str,
167
+ activation_kernel_backend: str,
168
+ ) -> io.NodeOutput:
169
+ loaded_pipeline, info = cls.legacy_loader_cls().load(
170
+ pipeline,
171
+ artifact_path,
172
+ strict,
173
+ runtime_mode,
174
+ activation_kernel_backend,
175
+ )
176
+ return io.NodeOutput(loaded_pipeline, info)
177
+
178
+
179
+ class OrbitQuantFluxLoaderV3(_OrbitQuantTransformerLoaderV3):
180
+ legacy_loader_cls = nodes.OrbitQuantFluxLoader
181
+ node_id = "OrbitQuantFluxLoader"
182
+ display_name = "OrbitQuant FLUX Loader"
183
+ description = "Attach a FLUX or FLUX.2 OrbitQuant transformer artifact to a pipeline."
184
+
185
+
186
+ class OrbitQuantZImageLoaderV3(_OrbitQuantTransformerLoaderV3):
187
+ legacy_loader_cls = nodes.OrbitQuantZImageLoader
188
+ node_id = "OrbitQuantZImageLoader"
189
+ display_name = "OrbitQuant Z-Image Loader"
190
+ description = "Attach a Z-Image OrbitQuant transformer artifact to a pipeline."
191
+
192
+
193
+ class OrbitQuantWanLoaderV3(_OrbitQuantTransformerLoaderV3):
194
+ legacy_loader_cls = nodes.OrbitQuantWanLoader
195
+ node_id = "OrbitQuantWanLoader"
196
+ display_name = "OrbitQuant Wan Loader"
197
+ description = "Attach a Wan OrbitQuant transformer artifact to a pipeline."
198
+
199
+
200
+ class OrbitQuantExtension(ComfyExtension):
201
+ async def get_node_list(self) -> list[type[io.ComfyNode]]:
202
+ return [
203
+ OrbitQuantArtifactInspectorV3,
204
+ OrbitQuantPipelineComponentLoaderV3,
205
+ OrbitQuantFluxLoaderV3,
206
+ OrbitQuantZImageLoaderV3,
207
+ OrbitQuantWanLoaderV3,
208
+ ]
209
+
210
+
211
+ async def comfy_entrypoint() -> OrbitQuantExtension:
212
+ return OrbitQuantExtension()
@@ -0,0 +1,166 @@
1
+ Metadata-Version: 2.4
2
+ Name: comfyui-orbitquant
3
+ Version: 0.1.0
4
+ Summary: ComfyUI custom nodes for OrbitQuant artifacts
5
+ Author: WaveCut
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.11
9
+ Requires-Dist: orbitquant>=0.1.2
10
+ Provides-Extra: dev
11
+ Requires-Dist: pytest>=8.4; extra == 'dev'
12
+ Requires-Dist: ruff>=0.12; extra == 'dev'
13
+ Description-Content-Type: text/markdown
14
+
15
+ # ComfyUI-OrbitQuant
16
+
17
+ ComfyUI custom nodes for inspecting OrbitQuant artifacts and attaching a
18
+ quantized transformer component to an existing pipeline object.
19
+
20
+ The quantization implementation lives in the `orbitquant` Python package. This
21
+ node pack only validates artifacts, reports metadata, and calls OrbitQuant's
22
+ component-loading API.
23
+
24
+ ## Nodes
25
+
26
+ | Node | Purpose |
27
+ | --- | --- |
28
+ | `OrbitQuant Inspect Artifact` | Validate an OrbitQuant artifact directory and return a text summary plus structured metadata. |
29
+ | `OrbitQuant Pipeline Component Loader` | Attach an OrbitQuant component artifact to a pipeline attribute such as `transformer`. |
30
+ | `OrbitQuant FLUX Loader` | Attach a FLUX or FLUX.2 transformer artifact and reject non-FLUX policies. |
31
+ | `OrbitQuant Z-Image Loader` | Attach a Z-Image transformer artifact and reject other target policies. |
32
+ | `OrbitQuant Wan Loader` | Attach a Wan transformer artifact and reject other target policies. |
33
+
34
+ The same nodes are exposed through the legacy `NODE_CLASS_MAPPINGS` interface
35
+ and the modern ComfyUI V3 `comfy_entrypoint` interface when `comfy_api` is
36
+ available.
37
+
38
+ ## Install
39
+
40
+ Clone this repository into ComfyUI's custom node directory:
41
+
42
+ ```bash
43
+ cd ComfyUI/custom_nodes
44
+ git clone https://github.com/iamwavecut/ComfyUI-OrbitQuant.git
45
+ ```
46
+
47
+ Install the `orbitquant` package into the Python environment used by ComfyUI.
48
+ Use the released package when available:
49
+
50
+ ```bash
51
+ python -m pip install "orbitquant>=0.1.2"
52
+ ```
53
+
54
+ For the default optimized `runtime_mode="auto_fused"` path on CUDA or for
55
+ Hub-published native packed matmul kernels, install OrbitQuant with its kernel
56
+ runtime extra:
57
+
58
+ ```bash
59
+ python -m pip install "orbitquant[kernels]>=0.1.2"
60
+ ```
61
+
62
+ For a source checkout, install the package from the local OrbitQuant repository:
63
+
64
+ ```bash
65
+ python -m pip install -e /path/to/OrbitQuant
66
+ ```
67
+
68
+ For a source checkout with the kernel runtime dependencies:
69
+
70
+ ```bash
71
+ python -m pip install -e "/path/to/OrbitQuant[kernels]"
72
+ ```
73
+
74
+ Restart ComfyUI after installation.
75
+
76
+ ## Usage
77
+
78
+ Use an OrbitQuant artifact directory produced by the OrbitQuant package or
79
+ downloaded from Hugging Face.
80
+
81
+ 1. Load or create the source Diffusers pipeline in your workflow.
82
+ 2. Add the matching OrbitQuant loader node.
83
+ 3. Set `artifact_path` to the local artifact directory.
84
+ 4. Connect the pipeline object into the loader node.
85
+ 5. Keep `runtime_mode` at `auto_fused` for optimized packed-weight inference.
86
+ 6. Use the returned pipeline object for the downstream generation nodes.
87
+
88
+ For model-specific loaders, the artifact `target_policy` is checked before the
89
+ component is attached:
90
+
91
+ | Loader | Accepted `target_policy` |
92
+ | --- | --- |
93
+ | `OrbitQuant FLUX Loader` | `flux`, `flux2` |
94
+ | `OrbitQuant Z-Image Loader` | `z_image` |
95
+ | `OrbitQuant Wan Loader` | `wan` |
96
+
97
+ ### Runtime Modes
98
+
99
+ `runtime_mode` defaults to `auto_fused`. On supported devices, OrbitQuant will
100
+ use packed low-bit matmul kernels instead of materializing a full BF16/FP16
101
+ weight matrix. `activation_kernel_backend` defaults to `auto`.
102
+
103
+ Use `runtime_mode="dequant_bf16"` only as an explicit compatibility or debug
104
+ path when packed kernels are not installed in the ComfyUI Python environment.
105
+
106
+ ## Artifact Requirements
107
+
108
+ The loader expects the standard OrbitQuant component artifact layout:
109
+
110
+ ```text
111
+ artifact/
112
+ README.md
113
+ SHA256SUMS
114
+ model_index.json
115
+ model.safetensors
116
+ quantization_config.json
117
+ orbitquant_manifest.json
118
+ orbitquant_codebooks.safetensors
119
+ orbitquant_rotations.safetensors
120
+ prompts.json
121
+ benchmark/summary.json
122
+ ```
123
+
124
+ `OrbitQuant Inspect Artifact` validates required files, checksums, tensor
125
+ shapes, source model metadata, bit settings, runtime mode, target policy, and
126
+ module counts.
127
+
128
+ ## Python API
129
+
130
+ The node classes can also be called directly from Python when building a custom
131
+ ComfyUI workflow wrapper.
132
+
133
+ Inspect an artifact:
134
+
135
+ ```python
136
+ from comfyui_orbitquant.nodes import OrbitQuantArtifactInspector
137
+
138
+ summary, info = OrbitQuantArtifactInspector().inspect(
139
+ "/models/orbitquant/flux1-schnell-w4a4"
140
+ )
141
+ print(summary)
142
+ print(info["target_policy"])
143
+ ```
144
+
145
+ Attach a FLUX-family transformer artifact to an existing pipeline object:
146
+
147
+ ```python
148
+ from comfyui_orbitquant.nodes import OrbitQuantFluxLoader
149
+
150
+ pipeline, info = OrbitQuantFluxLoader().load(
151
+ pipeline,
152
+ "/models/orbitquant/flux1-schnell-w4a4",
153
+ strict=True,
154
+ runtime_mode="auto_fused",
155
+ activation_kernel_backend="auto",
156
+ )
157
+ ```
158
+
159
+ The nodes delegate artifact parsing and component loading to OrbitQuant:
160
+
161
+ ```python
162
+ from orbitquant.artifacts import OrbitQuantManifest, validate_orbitquant_artifact
163
+ from orbitquant.pipeline import load_quantized_pipeline_component
164
+ ```
165
+
166
+ No quantization math or artifact parsing logic is duplicated in this repository.
@@ -0,0 +1,7 @@
1
+ comfyui_orbitquant/__init__.py,sha256=xts66sxlqsaLfKs6kJDdURYYWMJsqkmoayT6Wm4uDaA,363
2
+ comfyui_orbitquant/nodes.py,sha256=q3GNA2lPVZPw2LBTdxnFhC5LxTezCxeFJpP9tNo_f8E,11581
3
+ comfyui_orbitquant/v3.py,sha256=mQL9_u-ViKCcZncpPJjF6whl2DJo-3D1E6t7Gvy4__o,6427
4
+ comfyui_orbitquant-0.1.0.dist-info/METADATA,sha256=AJEpK-EHSjIePnzofssskFuRSzxf_E_PgoIEfmGTZ4I,5108
5
+ comfyui_orbitquant-0.1.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
6
+ comfyui_orbitquant-0.1.0.dist-info/licenses/LICENSE,sha256=Orr4cfDCpSSkczidbBw_wm4dbJvf3IG9nAfgURNuYUM,11339
7
+ comfyui_orbitquant-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.31.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted under this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 WaveCut
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.