Skip to content

Commit

Permalink
Fix EMAModel test_from_pretrained (#10325)
Browse files Browse the repository at this point in the history
  • Loading branch information
hlky authored Dec 21, 2024
1 parent a756694 commit bf9a641
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/others/test_ema.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def test_from_pretrained(self):

# Load the EMA model from the saved directory
loaded_ema_unet = EMAModel.from_pretrained(tmpdir, model_cls=UNet2DConditionModel, foreach=False)
loaded_ema_unet.to(torch_device)

# Check that the shadow parameters of the loaded model match the original EMA model
for original_param, loaded_param in zip(ema_unet.shadow_params, loaded_ema_unet.shadow_params):
Expand Down Expand Up @@ -221,6 +222,7 @@ def test_from_pretrained(self):

# Load the EMA model from the saved directory
loaded_ema_unet = EMAModel.from_pretrained(tmpdir, model_cls=UNet2DConditionModel, foreach=True)
loaded_ema_unet.to(torch_device)

# Check that the shadow parameters of the loaded model match the original EMA model
for original_param, loaded_param in zip(ema_unet.shadow_params, loaded_ema_unet.shadow_params):
Expand Down

0 comments on commit bf9a641

Please sign in to comment.