@@ -81,11 +81,9 @@ def _openvino_export(
81
81
model = model_class (f"hf_hub:{ model_name } " , pretrained = True , exportable = True )
82
82
TasksManager .standardize_model_attributes (model_name , model , library_name = library_name )
83
83
else :
84
- config = AutoConfig .from_pretrained (model_name )
85
- model_class = TasksManager .get_model_class_for_task (task , model_type = config .model_type .replace ("_" , "-" ))
86
- model = model_class .from_pretrained (model_name , ** loading_kwargs )
84
+ model = auto_model .auto_model_class .from_pretrained (model_name , ** loading_kwargs )
87
85
88
- if model .config . model_type == "pix2struct" :
86
+ if getattr ( model .config , " model_type" , None ) == "pix2struct" :
89
87
preprocessors = maybe_load_preprocessors (model_name )
90
88
else :
91
89
preprocessors = None
@@ -110,7 +108,7 @@ def _openvino_export(
110
108
self .assertEqual (ov_model .use_cache , use_cache )
111
109
112
110
if task == "text-generation" :
113
- self .assertEqual (ov_model .stateful , stateful )
111
+ self .assertEqual (ov_model .stateful , stateful and use_cache )
114
112
115
113
@parameterized .expand (SUPPORTED_ARCHITECTURES )
116
114
def test_export (self , model_type : str ):
0 commit comments