@@ -185,10 +185,19 @@ def test_shape(self, model_arch: str):
185
185
elif output_type == "pt" :
186
186
self .assertEqual (outputs .shape , (batch_size , 3 , height , width ))
187
187
else :
188
- out_channels = pipeline .unet .config .out_channels if pipeline .unet is not None else pipeline .transformer .config .out_channels
188
+ out_channels = (
189
+ pipeline .unet .config .out_channels
190
+ if pipeline .unet is not None
191
+ else pipeline .transformer .config .out_channels
192
+ )
189
193
self .assertEqual (
190
194
outputs .shape ,
191
- (batch_size , out_channels , height // pipeline .vae_scale_factor , width // pipeline .vae_scale_factor ),
195
+ (
196
+ batch_size ,
197
+ out_channels ,
198
+ height // pipeline .vae_scale_factor ,
199
+ width // pipeline .vae_scale_factor ,
200
+ ),
192
201
)
193
202
194
203
@parameterized .expand (SUPPORTED_ARCHITECTURES )
@@ -246,7 +255,7 @@ def test_negative_prompt(self, model_arch: str):
246
255
do_classifier_free_guidance = True ,
247
256
negative_prompt = negative_prompt ,
248
257
)
249
-
258
+
250
259
else :
251
260
inputs ["prompt_embeds" ], inputs ["negative_prompt_embeds" ] = pipeline .encode_prompt (
252
261
prompt = prompt ,
@@ -306,8 +315,10 @@ def test_height_width_properties(self, model_arch: str):
306
315
)
307
316
308
317
self .assertFalse (ov_pipeline .is_dynamic )
309
- expected_batch = batch_size * num_images_per_prompt
310
- if ov_pipeline .unet is not None and "timestep_cond" not in {inputs .get_any_name () for inputs in ov_pipeline .unet .model .inputs }:
318
+ expected_batch = batch_size * num_images_per_prompt
319
+ if ov_pipeline .unet is not None and "timestep_cond" not in {
320
+ inputs .get_any_name () for inputs in ov_pipeline .unet .model .inputs
321
+ }:
311
322
expected_batch *= 2
312
323
self .assertEqual (
313
324
ov_pipeline .batch_size ,
@@ -435,10 +446,19 @@ def test_shape(self, model_arch: str):
435
446
elif output_type == "pt" :
436
447
self .assertEqual (outputs .shape , (batch_size , 3 , height , width ))
437
448
else :
438
- out_channels = pipeline .unet .config .out_channels if pipeline .unet is not None else pipeline .transformer .config .out_channels
449
+ out_channels = (
450
+ pipeline .unet .config .out_channels
451
+ if pipeline .unet is not None
452
+ else pipeline .transformer .config .out_channels
453
+ )
439
454
self .assertEqual (
440
455
outputs .shape ,
441
- (batch_size , out_channels , height // pipeline .vae_scale_factor , width // pipeline .vae_scale_factor ),
456
+ (
457
+ batch_size ,
458
+ out_channels ,
459
+ height // pipeline .vae_scale_factor ,
460
+ width // pipeline .vae_scale_factor ,
461
+ ),
442
462
)
443
463
444
464
@parameterized .expand (SUPPORTED_ARCHITECTURES )
@@ -521,13 +541,12 @@ def test_height_width_properties(self, model_arch: str):
521
541
)
522
542
523
543
self .assertFalse (ov_pipeline .is_dynamic )
524
- expected_batch = batch_size * num_images_per_prompt
525
- if ov_pipeline .unet is not None and "timestep_cond" not in {inputs .get_any_name () for inputs in ov_pipeline .unet .model .inputs }:
544
+ expected_batch = batch_size * num_images_per_prompt
545
+ if ov_pipeline .unet is not None and "timestep_cond" not in {
546
+ inputs .get_any_name () for inputs in ov_pipeline .unet .model .inputs
547
+ }:
526
548
expected_batch *= 2
527
- self .assertEqual (
528
- ov_pipeline .batch_size ,
529
- expected_batch
530
- )
549
+ self .assertEqual (ov_pipeline .batch_size , expected_batch )
531
550
self .assertEqual (ov_pipeline .height , height )
532
551
self .assertEqual (ov_pipeline .width , width )
533
552
@@ -655,10 +674,19 @@ def test_shape(self, model_arch: str):
655
674
elif output_type == "pt" :
656
675
self .assertEqual (outputs .shape , (batch_size , 3 , height , width ))
657
676
else :
658
- out_channels = pipeline .unet .config .out_channels if pipeline .unet is not None else pipeline .transformer .config .out_channels
677
+ out_channels = (
678
+ pipeline .unet .config .out_channels
679
+ if pipeline .unet is not None
680
+ else pipeline .transformer .config .out_channels
681
+ )
659
682
self .assertEqual (
660
683
outputs .shape ,
661
- (batch_size , out_channels , height // pipeline .vae_scale_factor , width // pipeline .vae_scale_factor ),
684
+ (
685
+ batch_size ,
686
+ out_channels ,
687
+ height // pipeline .vae_scale_factor ,
688
+ width // pipeline .vae_scale_factor ,
689
+ ),
662
690
)
663
691
664
692
@parameterized .expand (SUPPORTED_ARCHITECTURES )
@@ -676,7 +704,7 @@ def test_compare_to_diffusers_pipeline(self, model_arch: str):
676
704
677
705
ov_output = ov_pipeline (** inputs , generator = get_generator ("pt" , SEED )).images
678
706
diffusers_output = diffusers_pipeline (** inputs , generator = get_generator ("pt" , SEED )).images
679
-
707
+
680
708
np .testing .assert_allclose (ov_output , diffusers_output , atol = 6e-3 , rtol = 1e-2 )
681
709
682
710
@parameterized .expand (SUPPORTED_ARCHITECTURES )
@@ -741,8 +769,10 @@ def test_height_width_properties(self, model_arch: str):
741
769
)
742
770
743
771
self .assertFalse (ov_pipeline .is_dynamic )
744
- expected_batch = batch_size * num_images_per_prompt
745
- if ov_pipeline .unet is not None and "timestep_cond" not in {inputs .get_any_name () for inputs in ov_pipeline .unet .model .inputs }:
772
+ expected_batch = batch_size * num_images_per_prompt
773
+ if ov_pipeline .unet is not None and "timestep_cond" not in {
774
+ inputs .get_any_name () for inputs in ov_pipeline .unet .model .inputs
775
+ }:
746
776
expected_batch *= 2
747
777
self .assertEqual (
748
778
ov_pipeline .batch_size ,
0 commit comments