Instructions to use rootonchair/ERNIE-Image-Turbo-nunchaku-lite-int4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use rootonchair/ERNIE-Image-Turbo-nunchaku-lite-int4 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("rootonchair/ERNIE-Image-Turbo-nunchaku-lite-int4", 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
ERNIE-Image-Turbo Nunchaku Lite INT4
Experimental: This Nunchaku Lite quantized ERNIE-Image-Turbo checkpoint is experimental. APIs, loading behavior may change.
This repository contains a full Diffusers pipeline for baidu/ERNIE-Image-Turbo with the transformer replaced by a Nunchaku Lite quantized transformer.
The tokenizer, text encoder, prompt enhancer, scheduler, and VAE are inherited from the original ERNIE-Image-Turbo release. Only the Diffusion Transformer component is replaced.
Quantization
The transformer uses a compact Nunchaku Lite quantization config stored in transformer/config.json.
| Op | Precision | Group size | Rank | Targets |
|---|---|---|---|---|
svdq_w4a4 |
int4 |
64 | 32 | 252 |
awq_w4a16 |
int4 |
64 | - | 6 |
Requirements
This checkpoint requires a Diffusers version that includes NunchakuLiteQuantizationConfig and the Nunchaku Lite loader path.
pip install git+https://github.com/huggingface/diffusers
pip install kernels
Use a CUDA-capable PyTorch environment. The quantized transformer uses kernels from the Hugging Face kernels package.
Usage
import torch
from diffusers import ErnieImagePipeline
pipe = ErnieImagePipeline.from_pretrained(
"rootonchair/ERNIE-Image-Turbo-nunchaku-lite-int4",
torch_dtype=torch.bfloat16,
).to("cuda")
image = pipe(
prompt="A modern red armchair in a quiet studio, soft window light, realistic product photography",
height=1024,
width=1024,
num_inference_steps=8,
guidance_scale=1.0,
use_pe=False,
).images[0]
image.save("ernie-image-turbo-nunchaku-lite-int4.png")
Recommended ERNIE-Image-Turbo settings:
num_inference_steps=8guidance_scale=1.0use_pe=Falsefor direct prompt usage, oruse_pe=Trueto enable the inherited prompt enhancer
Provenance
- Base pipeline: baidu/ERNIE-Image-Turbo
- Source quantized checkpoint: rootonchair/ERNIE-Image-Turbo-nunchaku-lite
Limitations
- This is an experimental quantized checkpoint.
- Only the transformer is quantized; the text encoder, prompt enhancer, scheduler, and VAE are inherited from the base model.
save_pretrained()serialization for Nunchaku Lite models is not supported yet.- Output quality and performance may differ from the original BF16 transformer.
License
This repository follows the Apache-2.0 license from the base ERNIE-Image-Turbo release.
- Downloads last month
- -