Repository navigation
Why do we need to move image to torch.float32 in FluxPipeline? #11392
Replies: 2 comments
|
Short version: it is mostly a defensive pin, not a functional transform — and no, the VAE encode itself does not run in float32 because of it. What the line actually does in the flow:
Is it a legacy from Stable Diffusion? Effectively yes — the whole method is marked Practical note if you are chasing fp16 artifacts in img2img: the fix is not this line. Load the VAE in fp32 ( |
|
It's a preprocessing boundary, not dead code. Everything between the image processor output and the VAE encode happens in fp32 so the normalize/rescale math ( The later cast inside So yes, partly inherited from the SD pipelines where the same convention applied, but in Flux it's still doing real work because bf16 is the common inference dtype there. — |
Uh oh!
There was an error while loading. Please reload this page.
👋
I dont quite understand the logic behind moving
init_imageto torch.float32 formatdiffusers/src/diffusers/pipelines/flux/pipeline_flux_img2img.py
Line 829 in 026507c
because next the variable is used in
prepare_latentsmethod where it is moved to another dtype. Is this a legacy from stable diffusion vae model or is there some other idea behind it?All reactions