Instructions to use black-forest-labs/FLUX.1-schnell with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use black-forest-labs/FLUX.1-schnell 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-schnell", dtype=torch.bfloat16, device_map="cuda") 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
A black image
#30
by PooriaT - opened
I attempted to run this model using the interface API (serverless). However, it's producing a black image. I even tested it by creating a space, but it failed to return the correct result and only displayed a black image.
What precision are you using, I've noticed float16 (instead of bfloat16) gives black images, it seems to be a vae issue, and it seems to be ignoring the automatic upcasting diffusers uses, it's set to upcast in the config,
I ended up replacing the vae.decode function to do upcast, anyone know if its the standard SDXL vae, so we could use madebyollin's fp16 fixed vae instead.
pipe.vae.to(torch.float32)
_vae_decode = pipe.vae.decode
def new_vae_decode(latents, *args, **kwargs):
latents = latents.to(torch.float32)
return _vae_decode(latents, *args, **kwargs)
pipe.vae.decode = new_vae_decode
I just got this issue, running the model with mistrals.