Skip to content

Commit 9a02e4b

Browse files
committed
add check warnings
1 parent 2a0c957 commit 9a02e4b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

tests/openvino/test_diffusion.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
import logging
1617
import unittest
1718
from pathlib import Path
1819

@@ -442,19 +443,28 @@ def test_load_custom_weight_variant(self):
442443
@require_diffusers
443444
def test_static_shape_image_generation(self, model_arch):
444445
pipeline = self.OVMODEL_CLASS.from_pretrained(MODEL_NAMES[model_arch], compile=False)
445-
pipeline.reshape(batch_size=1, height=64, width=32)
446+
pipeline.reshape(batch_size=1, height=32, width=32)
446447
pipeline.compile()
447448
# generation with incompatible size
448449
height, width, batch_size = 64, 64, 1
449450
inputs = self.generate_inputs(height=height, width=width, batch_size=batch_size)
450451
inputs["output_type"] = "pil"
451-
image = pipeline(**inputs).images[0]
452-
self.assertTupleEqual(image.size, (32, 64))
452+
from optimum.intel.openvino.modeling_diffusion import logger as diffusers_logger
453+
454+
with self.assertLogs(diffusers_logger, logging.WARN) as warning_log:
455+
image = pipeline(**inputs).images[0]
456+
self.assertTrue(
457+
any(
458+
"Incompatible width argument provided" in log or "Incompatible height argument provided" in log
459+
for log in warning_log.output
460+
)
461+
)
462+
self.assertTupleEqual(image.size, (32, 32))
453463
# generation without height / width provided
454464
inputs.pop("height")
455465
inputs.pop("width")
456466
image = pipeline(**inputs).images[0]
457-
self.assertTupleEqual(image.size, (32, 64))
467+
self.assertTupleEqual(image.size, (32, 32))
458468

459469

460470
class OVPipelineForImage2ImageTest(unittest.TestCase):

0 commit comments

Comments
 (0)