Skip to content

Commit c0e5a1a

Browse files
committed
Fixed tests
1 parent ed69ff1 commit c0e5a1a

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

tests/openvino/test_quantization.py

+16-17
Original file line numberDiff line numberDiff line change
@@ -329,23 +329,22 @@ def test_ovmodel_8bit_weight_compression_stateful(self, model_cls, model_id, exp
329329

330330
@parameterized.expand(SUPPORTED_ARCHITECTURES_WITH_AUTO_COMPRESSION)
331331
def test_ovmodel_load_with_compressed_weights(self, model_cls, model_type):
332-
with tempfile.TemporaryDirectory() as tmp_dir:
333-
model = model_cls.from_pretrained(MODEL_NAMES[model_type], export=True, load_in_8bit=True, stateful=False)
334-
335-
if model.export_feature.startswith("text2text-generation"):
336-
models = [model.encoder, model.decoder, model.decoder_with_past]
337-
elif model.export_feature.startswith("stable-diffusion"):
338-
models = [model.unet, model.vae_encoder, model.vae_decoder]
339-
models.append(
340-
model.text_encoder if model.export_feature == "stable-diffusion" else model.text_encoder_2
341-
)
342-
else:
343-
models = [model]
344-
345-
expected_ov_int8 = _ARCHITECTURES_TO_EXPECTED_INT8[model_type]
346-
for i, model in enumerate(models):
347-
_, num_int8, _ = get_num_quantized_nodes(model)
348-
self.assertEqual(expected_ov_int8[i], num_int8)
332+
model = model_cls.from_pretrained(MODEL_NAMES[model_type], export=True, load_in_8bit=True, stateful=False)
333+
334+
if model.export_feature.startswith("text2text-generation"):
335+
models = [model.encoder, model.decoder, model.decoder_with_past]
336+
elif model.export_feature.startswith("stable-diffusion"):
337+
models = [model.unet, model.vae_encoder, model.vae_decoder]
338+
models.append(
339+
model.text_encoder if model.export_feature == "stable-diffusion" else model.text_encoder_2
340+
)
341+
else:
342+
models = [model]
343+
344+
expected_ov_int8 = _ARCHITECTURES_TO_EXPECTED_INT8[model_type]
345+
for i, model in enumerate(models):
346+
_, num_int8, _ = get_num_quantized_nodes(model)
347+
self.assertEqual(expected_ov_int8[i], num_int8)
349348

350349
@parameterized.expand(SUPPORTED_ARCHITECTURES_WITH_EXPECTED_4BIT_AUTOCOMPRESSED_MATMULS)
351350
def test_ovmodel_4bit_auto_compression(self, model_cls, model_type, expected_ov_int8, expected_ov_int4):

0 commit comments

Comments
 (0)