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

Fix fine-tuning compatibility with deepspeed (#816)

This commit is contained in:
pink-red
2022-10-12 23:43:37 +04:00
committed by GitHub
parent 008b608f15
commit 60c384bcd2

View File

@@ -568,7 +568,7 @@ def main():
# Predict the noise residual and compute loss
noise_pred = unet(noisy_latents, timesteps, encoder_hidden_states).sample
loss = F.mse_loss(noise_pred, noise, reduction="mean")
loss = F.mse_loss(noise_pred.float(), noise.float(), reduction="mean")
# Gather the losses across all processes for logging (if we use distributed training).
avg_loss = accelerator.gather(loss.repeat(args.train_batch_size)).mean()