Instructions to use mit-han-lab/nunchaku-flux.1-kontext-dev with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use mit-han-lab/nunchaku-flux.1-kontext-dev with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("mit-han-lab/nunchaku-flux.1-kontext-dev", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
when will "unquantized_layers.safetensors" and "config.json" for kontext-dev be available? Thank you!!!!!
as the title
No need for these files starting from nunchaku v0.3.0.
Just download the model and load its path, and then you can use it.
Appreciate it!
I am using "NunchakuFluxTransformer2dModel" to load it and it requires a "config.json", "unquantized_layers.safetensors", and "transformer_blocks.safetensors". Are there any new pipeline which can load it like how it does for Flux.1-dev or is this just Comfyui:
"
from diffusers import FluxPipeline
from nunchaku.models.transformer_flux import NunchakuFluxTransformer2dModel
transformer = NunchakuFluxTransformer2dModel.from_pretrained("mit-han-lab/svdq-int4-flux.1-dev")
pipeline = FluxPipeline.from_pretrained(
"black-forest-labs/FLUX.1-dev", transformer=transformer, torch_dtype=torch.bfloat16
).to("cuda")"
When will the SVDQuant version come out? Thank you!
You can use this branch: https://github.com/mit-han-lab/nunchaku/tree/feat/kontext
I will merge it later today.
The usage: https://github.com/mit-han-lab/nunchaku/blob/feat/kontext/examples/flux.1-kontext-dev.py
Thank you very much!
