@@ -208,8 +208,12 @@ def test_ov_model_static_quantization_with_auto_dataset(
208
208
ov_model .save_pretrained (tmp_dir )
209
209
210
210
if model_cls == OVModelForSpeechSeq2Seq :
211
+ models = [ov_model .encoder .model , ov_model .decoder .model ]
212
+
213
+ if ov_model .decoder_with_past is not None :
214
+ models .append (ov_model .decoder_with_past .model )
211
215
for model , expected_fq , expected_i8 in zip (
212
- ( ov_model . encoder . model , ov_model . decoder . model , ov_model . decoder_with_past . model ) ,
216
+ models ,
213
217
expected_fake_quantize ,
214
218
expected_int8 ,
215
219
):
@@ -629,7 +633,9 @@ def test_ovmodel_load_with_compressed_weights(self, model_cls, model_type, trust
629
633
self .assertEqual (model ._openvino_config .dtype , "int8" )
630
634
631
635
if model .export_feature .startswith ("text2text-generation" ):
632
- models = [model .encoder , model .decoder , model .decoder_with_past ]
636
+ models = [model .encoder , model .decoder ]
637
+ if model .decoder_with_past is not None :
638
+ models .append (model .decoder_with_past )
633
639
elif model .export_feature == "text-to-image" :
634
640
models = [model .unet , model .vae_encoder , model .vae_decoder ]
635
641
models .append (model .text_encoder if model_type == "stable-diffusion" else model .text_encoder_2 )
@@ -772,7 +778,9 @@ def test_ovmodel_load_with_uncompressed_weights(self, model_cls, model_type, tru
772
778
MODEL_NAMES [model_type ], export = True , load_in_8bit = False , trust_remote_code = trust_remote_code
773
779
)
774
780
if model .export_feature .startswith ("text2text-generation" ):
775
- models = [model .encoder , model .decoder , model .decoder_with_past ]
781
+ models = [model .encoder , model .decoder ]
782
+ if model .decoder_with_past is not None :
783
+ models .append (model .decoder_with_past )
776
784
elif model .export_feature == "text-to-image" :
777
785
models = [model .unet , model .vae_encoder , model .vae_decoder ]
778
786
models .append (model .text_encoder if model_type == "stable-diffusion" else model .text_encoder_2 )
@@ -1205,9 +1213,14 @@ def test_calibration_data_uniqueness(self, model_name, apply_caching):
1205
1213
processor = AutoProcessor .from_pretrained (model_id )
1206
1214
1207
1215
calibration_data = []
1208
- ov_model .decoder_with_past .request = InferRequestWrapper (
1209
- ov_model .decoder_with_past .request , calibration_data , apply_caching = apply_caching
1210
- )
1216
+ if not ov_model .stateful :
1217
+ ov_model .decoder_with_past .request = InferRequestWrapper (
1218
+ ov_model .decoder_with_past .request , calibration_data , apply_caching = apply_caching
1219
+ )
1220
+ else :
1221
+ ov_model .decoder .request = InferRequestWrapper (
1222
+ ov_model .decoder .request , calibration_data , apply_caching = apply_caching
1223
+ )
1211
1224
for _ in range (2 ):
1212
1225
input_features = self ._generate_random_audio_data (processor )
1213
1226
ov_model .generate (input_features , max_new_tokens = 10 , min_new_tokens = 10 )
0 commit comments