File size: 3,597 Bytes
4a52558
 
 
 
c93c5f5
4a52558
 
c93c5f5
4a52558
 
 
 
 
 
 
 
 
 
4e32a20
4a52558
 
 
 
 
 
 
4e32a20
8f223b3
c9ee6fe
 
 
4e32a20
 
4a52558
 
 
 
 
 
 
b78ac1e
4a52558
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ffb2677
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
license: apache-2.0
base_model: baidu/ERNIE-Image-Turbo
library_name: diffusers
base_model_relation: quantized
tags:
- nunchaku-lite
- diffuse-compressor
- quantized
- ernie-image
- ernie-image-turbo
- text-to-image
- svdquant
- int4
- fp4
- diffusers
---


# ERNIE-Image-Turbo Nunchaku Lite

This repository contains Nunchaku Lite SVDQuant checkpoints for [baidu/ERNIE-Image-Turbo](https://huggingface.co/baidu/ERNIE-Image-Turbo).

- Runtime: [rootonchair/nunchaku-lite](https://github.com/rootonchair/nunchaku-lite.git)
- Quantization framework: [rootonchair/diffuse-compressor](https://github.com/rootonchair/diffuse-compressor.git)

> [!NOTE]
> **INT4 fixed-bias checkpoint:** <code>svdq-int4_r32-ernie-image-turbo-zero-svdq-fix-bias.safetensors</code> is a re-converted INT4 SVDQuant checkpoint
> with the exported SVDQ target biases zeroed. This avoids a known activation-shift folded-bias issue in the original INT4 export that
> can produce noise-like outputs under <code>nunchaku_lite</code>.
> Prefer the NVFP4 checkpoint on Blackwell GPUs for speed and quality; use this INT4 fixed-bias variant when testing the INT4 path.


## Checkpoints

| File | Quantization | Rank | Recommended hardware |
|---|---:|---:|---|
| `svdq-int4_r32-ernie-image-turbo.safetensors` | INT4 | 32 | Turing, Ampere, Ada |
| `svdq-nvfp4_r32-ernie-image-turbo.safetensors` | NVFP4 | 32 | Blackwell |

## Benchmark Results

![Benchmark comparison](benchmarks/comparison.png)

| BF16 Diffusers | Nunchaku Lite |
|---|---|
| ![BF16 Diffusers sample](benchmarks/original_diffusers.png) | ![Nunchaku Lite sample](benchmarks/nunchaku_lite.png) |

## Usage

```python
import torch
from diffusers import ErnieImagePipeline
from nunchaku_lite import load_nunchaku_pipeline

pipe = load_nunchaku_pipeline(
    "Baidu/ERNIE-Image-Turbo",
    pipeline_cls=ErnieImagePipeline,
    checkpoint="rootonchair/ERNIE-Image-Turbo-nunchaku-lite/svdq-nvfp4_r32-ernie-image-turbo.safetensors",
    precision="auto",
    torch_dtype=torch.bfloat16,
    device="cuda",
).to("cuda")

image = pipe(
    prompt="This is a photograph depicting an urban street scene. Shot at eye level, it shows a covered pedestrian or commercial street. Slightly below the center of the frame, a cyclist rides away from the camera toward the background, appearing as a dark silhouette against backlighting with indistinct details. The ground is paved with regular square tiles, bisected by a prominent tactile paving strip running through the scene, whose raised textures are clearly visible under the light. Light streams in diagonally from the right side of the frame, creating a strong backlight effect with a distinct Tyndall effect-visible light beams illuminating dust or vapor in the air and casting long shadows across the street. Several pedestrians appear on the left side and in the distance, some with their backs to the camera and others walking sideways, all rendered as silhouettes or semi-silhouettes. The overall color palette is warm, dominated by golden yellows and dark browns, evoking the atmosphere of dusk or early morning.",
    height=1264,
    width=848,
    num_inference_steps=8,
    guidance_scale=1.0,
    use_pe=True,
).images[0]

image.save("output.png")
```

For non-Blackwell GPUs, use the INT4 checkpoint instead:

```python
checkpoint="rootonchair/ERNIE-Image-Turbo-nunchaku-lite/svdq-int4_r32-ernie-image-turbo.safetensors"
```

## Citation

This is a quantized derivative of [baidu/ERNIE-Image-Turbo](https://huggingface.co/baidu/ERNIE-Image-Turbo). Please follow the base model's license and citation guidance.