Instructions to use InstantX/FLUX.1-dev-Controlnet-Union with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use InstantX/FLUX.1-dev-Controlnet-Union with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("InstantX/FLUX.1-dev-Controlnet-Union", 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
Great model! I did a Gradio space based on it and found a couple of issues
#15
by jiuface - opened
When the resolution is greater than 768, there is a high chance of encountering an Out Of Memory (OOM) error:
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 576.00 MiB (GPU 0; 39.25 GiB total capacity; 38.15 GiB already allocated; 199.88 MiB free; 38.78 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONFThe training image set seems small? In many cases, the results are even less impressive compared to SDXL.
The token limit restricts the creative potential of Flux:
Token indices sequence length is longer than the specified maximum sequence length for this model (270 > 77). Running this sequence through the model will result in indexing errors. The following part of your input was truncated because CLIP can only handle sequences up to 77 tokens:
Finally, here's the link to my space. I'm eagerly looking forward to future updates:
https://huggingface.co/spaces/jiuface/FLUX.1-dev-Controlnet-Union