@@ -150,12 +150,10 @@ def _save_pretrained(self, save_directory: Union[str, Path]):
150
150
151
151
self ._save_openvino_config (save_directory )
152
152
153
-
154
153
def _save_openvino_config (self , save_directory : Union [str , Path ]):
155
154
if self ._openvino_config is not None :
156
155
self ._openvino_config .save_pretrained (save_directory )
157
156
158
-
159
157
@classmethod
160
158
def _from_pretrained (
161
159
cls ,
@@ -216,12 +214,21 @@ def _from_pretrained(
216
214
local_files_only = local_files_only ,
217
215
)
218
216
219
- quantization_config = self ._prepare_quantization_config (quantization_config , load_in_8bit )
217
+ quantization_config = cls ._prepare_quantization_config (quantization_config , load_in_8bit )
220
218
221
219
model = cls .load_model (model_cache_path , quantization_config = quantization_config )
222
- return cls (model , config = config , model_save_dir = model_cache_path .parent , quantization_config = quantization_config , ** kwargs )
220
+ return cls (
221
+ model ,
222
+ config = config ,
223
+ model_save_dir = model_cache_path .parent ,
224
+ quantization_config = quantization_config ,
225
+ ** kwargs ,
226
+ )
223
227
224
- def _prepare_quantization_config (quantization_config : Optional [Union [OVWeightQuantizationConfig , Dict ]] = None , load_in_8bit :bool = False ):
228
+ @staticmethod
229
+ def _prepare_quantization_config (
230
+ quantization_config : Optional [Union [OVWeightQuantizationConfig , Dict ]] = None , load_in_8bit : bool = False
231
+ ):
225
232
# Give default quantization config if not provided and load_in_8bit=True
226
233
if not quantization_config and load_in_8bit :
227
234
quantization_config = OVWeightQuantizationConfig (bits = 8 )
0 commit comments