Skip to content

Commit 40f3dac

Browse files
committed
fix task recognition
1 parent c127d51 commit 40f3dac

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

optimum/exporters/openvino/stateful.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,18 @@ def ensure_stateful_is_available(warn=True):
195195
"text2text-generation",
196196
)
197197

198+
_DECODER_TASKS_WITH_PAST = ("text-generation",)
198199

199-
def ensure_export_task_support_stateful(task: str, is_encoder_decoder: bool = False):
200+
201+
def ensure_export_task_support_stateful(task: str):
200202
from optimum.exporters import TasksManager
201203

202204
task = TasksManager.map_from_synonym(task)
203205

204-
if not is_encoder_decoder:
205-
return task in ["text-generation-with-past"]
206-
207-
is_stateful = task.endswith("-with-past") and task.replace("-with-past", "") in _ENCODER_DECODER_TASKS_WITH_PAST
206+
is_stateful = (
207+
task.endswith("-with-past")
208+
and task.replace("-with-past", "") in _ENCODER_DECODER_TASKS_WITH_PAST + _DECODER_TASKS_WITH_PAST
209+
)
208210
return is_stateful
209211

210212

0 commit comments

Comments
 (0)