-
Notifications
You must be signed in to change notification settings - Fork 6.9k
how to use black-forest-labs/FLUX.2-klein-9B with Batch inference #13350
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
batch inference produce 4 times of images
I have prompt is list of str. the length of prompt is 7.
but finally give me 28 images
Reproduction
import diffusers, torch
diffusers.Flux2KleinPipeline.from_pretrained('black-forest-labs/FLUX.2-klein-9B', torch_dtype=torch.bfloat16, quantization_config=diffusers.PipelineQuantizationConfig(quant_backend='bitsandbytes_4bit', quant_kwargs={'load_in_4bit':True, 'bnb_4bit_quant_type':'nf4', 'bnb_4bit_compute_dtype':torch.bfloat16}, components_to_quantize=['transformer', 'text_encoder'])).save_pretrained('flux')
flux = diffusers.Flux2KleinPipeline.from_pretrained('flux', torch_dtype=torch.bfloat16)
flux._exclude_from_cpu_offload = ['vae']
flux.enable_model_cpu_offload()
image = flux(prompt='a gorgeous japanese girl', height=1280, width=720, num_inference_steps=8, guidance_scale=1).images[0]
prompt = ['her left hand finger on her chest',
'her right hand finger on chest',
'camera rapidly zoom in close-up shot to her face',
'Camera pulls back to reveal her full body',
'Overhead shot of her full body. The camera rolls in full 360 motion',
'Camera hitchcock zooms in to her feet',
'Camera slowly tilts up to her head']
flux(image=image, prompt=prompt, height=1280, width=720, num_inference_steps=8, guidance_scale=1).images # why 28 images not 7?Logs
System Info
ubuntu22.04-cuda12.4.0-py311-torch2.8.0
Who can help?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working