Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
# Nunchaku
|
| 5 |
+
Python package for Nunchaku - post-training quantization with 4-bit weights and activations.
|
| 6 |
+
|
| 7 |
+
## Installation
|
| 8 |
+
```py
|
| 9 |
+
pip install nunchaku-0.0.2b0-cp311-cp311-linux_x86_64.whl
|
| 10 |
+
```
|
| 11 |
+
## Usage
|
| 12 |
+
```py
|
| 13 |
+
import torch
|
| 14 |
+
from diffusers import FluxPipeline
|
| 15 |
+
|
| 16 |
+
from nunchaku.models.transformer_flux import NunchakuFluxTransformer2dModel
|
| 17 |
+
|
| 18 |
+
transformer = NunchakuFluxTransformer2dModel.from_pretrained("mit-han-lab/svdq-int4-flux.1-schnell")
|
| 19 |
+
pipeline = FluxPipeline.from_pretrained(
|
| 20 |
+
"black-forest-labs/FLUX.1-schnell", transformer=transformer, torch_dtype=torch.bfloat16
|
| 21 |
+
).to("cuda")
|
| 22 |
+
image = pipeline("A cat holding a sign that says hello world", num_inference_steps=4, guidance_scale=0).images[0]
|
| 23 |
+
image.save("example.png")
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
refer to https://github.com/mit-han-lab/nunchaku for move details, this is not an official release of the pkg
|