Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: flux-dev-non-commercial-license
|
| 4 |
+
license_link: LICENSE.md
|
| 5 |
+
base_model:
|
| 6 |
+
- black-forest-labs/FLUX.2-dev
|
| 7 |
+
base_model_relation: quantized
|
| 8 |
+
library_name: diffusers
|
| 9 |
+
tags:
|
| 10 |
+
- sdnq
|
| 11 |
+
- flux
|
| 12 |
+
- image-editing
|
| 13 |
+
- 4-bit
|
| 14 |
+
---
|
| 15 |
+
4 bit (UINT4 with SVD rank 32) quantization of [black-forest-labs/FLUX.2-dev](https://huggingface.co/black-forest-labs/FLUX.2-dev) using [SDNQ](https://github.com/vladmandic/sdnext/wiki/SDNQ-Quantization).
|
| 16 |
+
|
| 17 |
+
Usage:
|
| 18 |
+
```
|
| 19 |
+
pip install git+https://github.com/Disty0/sdnq
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
```py
|
| 23 |
+
import torch
|
| 24 |
+
import diffusers
|
| 25 |
+
from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers
|
| 26 |
+
|
| 27 |
+
pipe = diffusers.Flux2Pipeline.from_pretrained("Disty0/FLUX.2-dev-SDNQ-uint4-svd-r32", torch_dtype=torch.bfloat16)
|
| 28 |
+
pipe.enable_model_cpu_offload()
|
| 29 |
+
|
| 30 |
+
prompt = "Realistic macro photograph of a hermit crab using a soda can as its shell, partially emerging from the can, captured with sharp detail and natural colors, on a sunlit beach with soft shadows and a shallow depth of field, with blurred ocean waves in the background. The can has the text `BFL Diffusers` on it and it has a color gradient that start with #FF5733 at the top and transitions to #33FF57 at the bottom."
|
| 31 |
+
|
| 32 |
+
image = pipe(
|
| 33 |
+
prompt=prompt,
|
| 34 |
+
generator=torch.manual_seed(42),
|
| 35 |
+
num_inference_steps=50,
|
| 36 |
+
guidance_scale=4,
|
| 37 |
+
).images[0]
|
| 38 |
+
image.save("flux-2-dev-sdnq-uint4-svd-r32.png")
|
| 39 |
+
```
|