Instructions to use WaveCut/FLUX.2-klein-9B-OrbitQuant-W4A4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use WaveCut/FLUX.2-klein-9B-OrbitQuant-W4A4 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("WaveCut/FLUX.2-klein-9B-OrbitQuant-W4A4", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Document OrbitQuant 0.4.0 on-the-fly conversion
Browse files- README.md +35 -1
- SHA256SUMS +1 -1
README.md
CHANGED
|
@@ -32,7 +32,7 @@ OrbitQuant paper itself leaves text encoders in BF16.
|
|
| 32 |
## Install
|
| 33 |
|
| 34 |
```bash
|
| 35 |
-
pip install "orbitquant[kernels]>=0.
|
| 36 |
```
|
| 37 |
|
| 38 |
OrbitQuant uses packed low-bit inference by default. CUDA first uses an importable
|
|
@@ -71,6 +71,40 @@ image = pipe(
|
|
| 71 |
image.save("orbitquant.png")
|
| 72 |
```
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
## Transformers Component
|
| 75 |
|
| 76 |
The quantized Qwen3 component can also be loaded through Transformers:
|
|
|
|
| 32 |
## Install
|
| 33 |
|
| 34 |
```bash
|
| 35 |
+
pip install "orbitquant[hf,kernels]>=0.4.0"
|
| 36 |
```
|
| 37 |
|
| 38 |
OrbitQuant uses packed low-bit inference by default. CUDA first uses an importable
|
|
|
|
| 71 |
image.save("orbitquant.png")
|
| 72 |
```
|
| 73 |
|
| 74 |
+
## Convert the source checkpoint on load
|
| 75 |
+
|
| 76 |
+
To create a fresh transformer-only OrbitQuant pipeline directly from the source
|
| 77 |
+
safetensors checkpoint, use the normal Diffusers loader. This row-streams source
|
| 78 |
+
weights into packed tensors instead of keeping the complete BF16 transformer and
|
| 79 |
+
the quantized transformer resident together:
|
| 80 |
+
|
| 81 |
+
```python
|
| 82 |
+
import torch
|
| 83 |
+
import orbitquant
|
| 84 |
+
from diffusers import DiffusionPipeline
|
| 85 |
+
from orbitquant import (
|
| 86 |
+
OrbitQuantConfig,
|
| 87 |
+
build_diffusers_pipeline_quantization_config,
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
qconfig = build_diffusers_pipeline_quantization_config(
|
| 91 |
+
OrbitQuantConfig(target_policy="auto"),
|
| 92 |
+
components="transformer",
|
| 93 |
+
)
|
| 94 |
+
pipe = DiffusionPipeline.from_pretrained(
|
| 95 |
+
"black-forest-labs/FLUX.2-klein-9B",
|
| 96 |
+
quantization_config=qconfig,
|
| 97 |
+
torch_dtype=torch.bfloat16,
|
| 98 |
+
)
|
| 99 |
+
pipe.enable_model_cpu_offload()
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
Use `pipe.enable_sequential_cpu_offload()` instead for sequential offload. The
|
| 103 |
+
published artifact also quantizes its text encoder for the SDNQ comparison;
|
| 104 |
+
on-the-fly conversion keeps text encoders in source precision unless they are
|
| 105 |
+
explicitly included in `components`. Guaranteed bounded-memory conversion
|
| 106 |
+
requires a safetensors source checkpoint.
|
| 107 |
+
|
| 108 |
## Transformers Component
|
| 109 |
|
| 110 |
The quantized Qwen3 component can also be loaded through Transformers:
|
SHA256SUMS
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
468d9f4332c0c895e9132c035982a40a12750092603a2e910913cb49aa887d3b ./LICENSE.md
|
| 2 |
-
|
| 3 |
02f199e9e833501e8ee57418016ca3514376a90a6f952c46e2542c6d1ec3ff27 ./assets/image_generation_comparison_matrix.webp
|
| 4 |
8155fb3d937b8dca2113f5bd16dbba847104ed3420c34bdedc551b3e6f792120 ./benchmark/build.json
|
| 5 |
1eccd6b514c82c9bb71d7705ca92761f1b54e9daae881d010bad4ba0251254be ./benchmark/summary.json
|
|
|
|
| 1 |
468d9f4332c0c895e9132c035982a40a12750092603a2e910913cb49aa887d3b ./LICENSE.md
|
| 2 |
+
f130b8f439a4090defa68feb0ecb17e5616b902b259a4281539a4a0ddcd18bee ./README.md
|
| 3 |
02f199e9e833501e8ee57418016ca3514376a90a6f952c46e2542c6d1ec3ff27 ./assets/image_generation_comparison_matrix.webp
|
| 4 |
8155fb3d937b8dca2113f5bd16dbba847104ed3420c34bdedc551b3e6f792120 ./benchmark/build.json
|
| 5 |
1eccd6b514c82c9bb71d7705ca92761f1b54e9daae881d010bad4ba0251254be ./benchmark/summary.json
|