Buckets:

Mercity/FluxDistill / build_nunchaku /src /examples /flux.1-dev-qencoder.py
Pranav2748's picture
download
raw
873 Bytes
import torch
from diffusers import FluxPipeline
from nunchaku import NunchakuFluxTransformer2dModel, NunchakuT5EncoderModel
from nunchaku.utils import get_precision
precision = get_precision() # auto-detect your precision is 'int4' or 'fp4' based on your GPU
transformer = NunchakuFluxTransformer2dModel.from_pretrained(
f"nunchaku-tech/nunchaku-flux.1-dev/svdq-{precision}_r32-flux.1-dev.safetensors"
)
text_encoder_2 = NunchakuT5EncoderModel.from_pretrained("mit-han-lab/nunchaku-t5/awq-int4-flux.1-t5xxl.safetensors")
pipeline = FluxPipeline.from_pretrained(
"black-forest-labs/FLUX.1-dev",
text_encoder_2=text_encoder_2,
transformer=transformer,
torch_dtype=torch.bfloat16,
).to("cuda")
image = pipeline("A cat holding a sign that says hello world", num_inference_steps=50, guidance_scale=3.5).images[0]
image.save(f"flux.1-dev-{precision}.png")

Xet Storage Details

Size:
873 Bytes
·
Xet hash:
b24c0603b09c9f20213aaf105dd8bf1545e20222dbf1cd6b7d1c6a318cb2cb47

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.