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

Fix mixed precision issue by wrapping the offending code with the torch.autocast context manager.

This commit is contained in:
Daniel Gu
2023-05-11 07:44:15 -07:00
parent 7242f1bba9
commit 1a58958ab4

View File

@@ -1246,7 +1246,8 @@ class UniDiffuserPipeline(DiffusionPipeline):
)
if reduce_text_emb_dim:
prompt_embeds = self.text_decoder.encode_prefix(prompt_embeds)
with torch.autocast(device_type=device.type):
prompt_embeds = self.text_decoder.encode_prefix(prompt_embeds)
# 4. Encode image, if available; otherwise prepare image latents
if mode in ["img2text"]: