1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

[examples/controlnet/train_controlnet_sd3.py] Fixes #11050 - Cast prompt_embeds and pooled_prompt_embeds to weight_dtype to prevent dtype mismatch (#11051)

Fix: dtype mismatch of prompt embeddings in sd3 controlnet training

Co-authored-by: Andreas Jörg <andreasjoerg@MacBook-Pro-von-Andreas-2.fritz.box>
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
This commit is contained in:
Andreas Jörg
2025-03-14 13:03:15 +01:00
committed by GitHub
parent 124ac3e81f
commit 8ead643bb7

View File

@@ -1283,8 +1283,8 @@ def main(args):
noisy_model_input = (1.0 - sigmas) * model_input + sigmas * noise
# Get the text embedding for conditioning
prompt_embeds = batch["prompt_embeds"]
pooled_prompt_embeds = batch["pooled_prompt_embeds"]
prompt_embeds = batch["prompt_embeds"].to(dtype=weight_dtype)
pooled_prompt_embeds = batch["pooled_prompt_embeds"].to(dtype=weight_dtype)
# controlnet(s) inference
controlnet_image = batch["conditioning_pixel_values"].to(dtype=weight_dtype)