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

Don't copy when unwrapping model (#2166)

* Don't copy when unwrapping model.

Otherwise an exception is raised when using fp16.

* Remove unused import
This commit is contained in:
Pedro Cuenca
2023-01-30 20:18:20 +01:00
committed by GitHub
parent 164b6e0532
commit 44f6bc81c7

View File

@@ -1,5 +1,4 @@
import argparse
import copy
import inspect
import logging
import math
@@ -530,7 +529,7 @@ def main(args):
# Generate sample images for visual inspection
if accelerator.is_main_process:
if epoch % args.save_images_epochs == 0 or epoch == args.num_epochs - 1:
unet = copy.deepcopy(accelerator.unwrap_model(model))
unet = accelerator.unwrap_model(model)
if args.use_ema:
ema_model.copy_to(unet.parameters())
pipeline = DDPMPipeline(