OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[TRANSFORMATIONS] SDPAToPA add the model is stateful check (#33002)
Andrii Staikovf2d4c75b1313
diff --git a/src/core/src/pass/sdpa_to_paged_attention.cpp b/src/core/src/pass/sdpa_to_paged_attention.cppindex 1750ad88c5b..7b658854114 100644--- a/src/core/src/pass/sdpa_to_paged_attention.cpp+++ b/src/core/src/pass/sdpa_to_paged_attention.cpp@@ -46,6 +46,12 @@ static std::shared_ptr<v0::Parameter> setName(std::shared_ptr<v0::Parameter> nodbool ov::pass::SDPAToPagedAttention::run_on_model(const std::shared_ptr<ov::Model>& model) {RUN_ON_MODEL_SCOPE(SDPAToPagedAttention);+ OPENVINO_ASSERT(!model->get_variables().empty(),+ "Model is supposed to be stateful, cannot perform "+ "the SDPAToPagedAttention transformation. "+ "For proper conversion run: optimum-cli export openvino --task text-generation-with-past instead "+ "of --task text-generation");+OPENVINO_ASSERT(ov::op::util::has_op_with_type<ov::op::v13::ScaledDotProductAttention>(model),"No ScaledDotProductAttention operation observed in the graph, cannot perform ""the SDPAToPagedAttention transformation.");