@@ -1006,7 +1006,7 @@ std::shared_ptr<ov::Model> prepare_decoder_model(std::shared_ptr<ov::Model>& mod
10061006 // 3) Expose all states that requires initialization on the first run as outputs
10071007 expose_runtime_states_as_outputs (decoder_model);
10081008 // 4) Remove cache_position input if it exists
1009- if (ov::genai::utils::input_exists (decoder_model, " cache_position" )) {
1009+ if (ov::genai::utils::has_input (decoder_model, " cache_position" )) {
10101010 remove_cache_position (decoder_model);
10111011 }
10121012 // 5) Normalize output names - should be done in stateful_to_stateless_transformation
@@ -1023,10 +1023,6 @@ std::shared_ptr<ov::Model> prepare_decoder_with_past_model(std::shared_ptr<ov::M
10231023 normalize_output_key_value_names (decoder_with_past_model);
10241024 expose_runtime_states_as_inputs (decoder_with_past_model);
10251025
1026- if (!ov::genai::utils::input_exists (decoder_with_past_model, " cache_position" )) {
1027- add_cache_position_input (decoder_with_past_model);
1028- }
1029-
10301026 decoder_with_past_model->reshape ({{" input_ids" , ov::PartialShape ({-1 , 1 })}});
10311027 decoder_with_past_model->set_friendly_name (" Model6" );
10321028
@@ -1066,6 +1062,10 @@ WhisperPipeline::StaticWhisperPipeline::StaticWhisperPipeline(const std::filesys
10661062 if (!decoder_model || !decoder_with_past_model)
10671063 OPENVINO_THROW (" Decoder/decoder_with_past model is not valid !" );
10681064
1065+ if (!ov::genai::utils::has_input (decoder_with_past_model, " cache_position" )) {
1066+ add_cache_position_input (decoder_with_past_model);
1067+ }
1068+
10691069 add_attention_mask_input (decoder_model, true /* transform_cross_attn */ , last_hidden_state_shape[1 ].get_length ());
10701070 // NB: Note, there is no need to transform cross attention for decoder_with_past_model
10711071 // as it accepts only single token and there can't be any padding.
0 commit comments