File tree 1 file changed +7
-5
lines changed
optimum/exporters/openvino
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -195,16 +195,18 @@ def ensure_stateful_is_available(warn=True):
195
195
"text2text-generation" ,
196
196
)
197
197
198
+ _DECODER_TASKS_WITH_PAST = ("text-generation" ,)
198
199
199
- def ensure_export_task_support_stateful (task : str , is_encoder_decoder : bool = False ):
200
+
201
+ def ensure_export_task_support_stateful (task : str ):
200
202
from optimum .exporters import TasksManager
201
203
202
204
task = TasksManager .map_from_synonym (task )
203
205
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
+ )
208
210
return is_stateful
209
211
210
212
You can’t perform that action at this time.
0 commit comments