Uh oh!
There was an error while loading. Please reload this page.
[Dreambooth flux] bug fix for dreambooth script (align with dreambooth lora) - #9257
Conversation
HuggingFaceDocBuilderDev
commented
Aug 23, 2024
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
| height=int(model_input.shape[2] * vae_scale_factor / 2), | ||
| width=int(model_input.shape[3] * vae_scale_factor / 2), |
There was a problem hiding this comment.
Where is this from?
We don't additionally scale it by "/2".
There was a problem hiding this comment.
it's just a modification from the original version of the training scripts where we had
model_pred = FluxPipeline._unpack_latents(
model_pred,
height=int(model_input.shape[2] * 8),
width=int(model_input.shape[3] * 8),
vae_scale_factor=vae_scale_factor,
)
and it didnt work with all resolutions, so we fixed in the previous PR for the LoRA script
(in the pipeline there is this- diffusers/src/diffusers/pipelines/flux/pipeline_flux.py)
There was a problem hiding this comment.
Yeah but we still don't have to do the additional scaling in the original pipeline, no? And it works with multiple resolutions without that. So, I am struggling to understand why we would need it here.
There was a problem hiding this comment.
in the pipeline we first scale in prepare_latents the width and height by
height = 2 * (int(height) // self.vae_scale_factor)
width = 2 * (int(width) // self.vae_scale_factor)
but we don't override them, so when they're sent to unpack_latents it's the x8 of the scaled version here^
in the training script, we send
height=model_input.shape[2],
width=model_input.shape[3],
to pack_latents - which is already a scaled down version because it happens after vae encoding.
i.e. model_input.shape[2] is equivalent to 2 * (int(height) // self.vae_scale_factor) in shape
that's why when we call unpack_latents in the training script we need to scale up
There was a problem hiding this comment.
Ah okay. Thanks for explaining this. Perhaps we could add a link to this comment in our script for our bookkeeping?
linoytsaban
commented
Aug 26, 2024
@sayakpaul shall we merge? |
sayakpaul
commented
Aug 26, 2024
Thank you! |
…h lora) (#9257) * fix shape * fix prompt encoding * style * fix device * add comment
fixes#9204 (comment)