Instructions to use ByteDance/Hyper-SD with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ByteDance/Hyper-SD with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("ByteDance/Hyper-SD") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
Anyway to make it work in fp8 transformer?
#54
by chuckma - opened
import torch
from diffusers import FluxTransformer2DModel, FluxPipeline
from transformers import T5EncoderModel, CLIPTextModel
from optimum.quanto import freeze, qfloat8, quantize
bfl_repo = "black-forest-labs/FLUX.1-dev"
dtype = torch.bfloat16
transformer = FluxTransformer2DModel.from_single_file("https://huggingface.co/Kijai/flux-fp8/blob/main/flux1-dev-fp8.safetensors", torch_dtype=dtype)
quantize(transformer, weights=qfloat8)
freeze(transformer)
from diffusers import FluxPipeline
import torch
pipe = FluxPipeline.from_pretrained(bfl_repo,
transformer=transformer,
torch_dtype=dtype)
pipe.enable_model_cpu_offload()
repo_name = "ByteDance/Hyper-SD"
# Take 8-steps lora as an example
ckpt_8steps_name = "Hyper-FLUX.1-dev-8steps-lora.safetensors"
pipe.load_lora_weights(hf_hub_download(repo_name, ckpt_8steps_name),
adapter_name="default")
Not work if i quantize the transformer first. I want to switch to another lora even after quantize the transformer. Any advice?
hi, have you solved this problem?
I see. Newer diffusers version solves the problem.(maybe in 0.31)
chuckma changed discussion status to closed