diff --git a/ggml/src/ggml-openvino/openvino/translate_session.cpp b/ggml/src/ggml-openvino/openvino/translate_session.cpp index 8cbc3eeef82..23a1dea2496 100644 --- a/ggml/src/ggml-openvino/openvino/translate_session.cpp +++ b/ggml/src/ggml-openvino/openvino/translate_session.cpp @@ -78,10 +78,11 @@ ov::pass::MakeStateful::ParamResPairs get_kv_param_res_pairs( } void add_sliced_mask(TensorMap & tensor_map, GgmlDecoder & ggml_model_decoder) { - auto token_len_per_seq = tensor_map.at("token_len_per_seq").get_node_shared_ptr(); auto create_sliced_mask = [&](const std::string & mask_name, const std::string & sliced_name, bool is_static) { - if (tensor_map.find(mask_name) != tensor_map.end()) { + if ((tensor_map.find(mask_name) != tensor_map.end()) && + (tensor_map.find("token_len_per_seq") != tensor_map.end())) { + auto token_len_per_seq = tensor_map.at("token_len_per_seq").get_node_shared_ptr(); auto mask = tensor_map.at(mask_name).get_node_shared_ptr(); std::shared_ptr mask_sliced; if (is_static) {