@@ -241,23 +241,15 @@ def git_config_username_and_email(self, git_user: str = None, git_email: str = N
241241 def _load_config (
242242 cls ,
243243 config_name_or_path : Union [str , os .PathLike ],
244- revision : Optional [str ] = None ,
245- cache_dir : str = HUGGINGFACE_HUB_CACHE ,
246- use_auth_token : Optional [Union [bool , str ]] = None ,
247- token : Optional [Union [bool , str ]] = None ,
248- force_download : bool = False ,
244+ # hub options
249245 subfolder : str = "" ,
246+ revision : str = "main" ,
247+ force_download : bool = False ,
248+ local_files_only : bool = False ,
250249 trust_remote_code : bool = False ,
250+ cache_dir : str = HUGGINGFACE_HUB_CACHE ,
251+ token : Optional [Union [bool , str ]] = None ,
251252 ) -> PretrainedConfig :
252- if use_auth_token is not None :
253- warnings .warn (
254- "The `use_auth_token` argument is deprecated and will be removed soon. Please use the `token` argument instead." ,
255- FutureWarning ,
256- )
257- if token is not None :
258- raise ValueError ("You cannot use both `use_auth_token` and `token` arguments at the same time." )
259- token = use_auth_token
260-
261253 try :
262254 config = AutoConfig .from_pretrained (
263255 pretrained_model_name_or_path = config_name_or_path ,
@@ -290,14 +282,14 @@ def _load_config(
290282 def _from_pretrained (
291283 cls ,
292284 model_id : Union [str , Path ],
293- config : PretrainedConfig ,
294- use_auth_token : Optional [Union [bool , str ]] = None ,
295- token : Optional [Union [bool , str ]] = None ,
296- revision : Optional [str ] = None ,
297- force_download : bool = False ,
298- cache_dir : str = HUGGINGFACE_HUB_CACHE ,
285+ # hub options
299286 subfolder : str = "" ,
287+ revision : str = "main" ,
288+ force_download : bool = False ,
300289 local_files_only : bool = False ,
290+ trust_remote_code : bool = False ,
291+ cache_dir : str = HUGGINGFACE_HUB_CACHE ,
292+ token : Optional [Union [bool , str ]] = None ,
301293 ** kwargs ,
302294 ) -> "OptimizedModel" :
303295 """Overwrite this method in subclass to define how to load your model from pretrained"""
@@ -308,14 +300,14 @@ def _export(
308300 cls ,
309301 model_id : Union [str , Path ],
310302 config : PretrainedConfig ,
311- use_auth_token : Optional [Union [bool , str ]] = None ,
312- token : Optional [Union [bool , str ]] = None ,
313- revision : Optional [str ] = None ,
314- force_download : bool = False ,
315- cache_dir : str = HUGGINGFACE_HUB_CACHE ,
303+ # hub options
316304 subfolder : str = "" ,
305+ revision : str = "main" ,
306+ force_download : bool = False ,
317307 local_files_only : bool = False ,
318308 trust_remote_code : bool = False ,
309+ cache_dir : str = HUGGINGFACE_HUB_CACHE ,
310+ token : Optional [Union [bool , str ]] = None ,
319311 ** kwargs ,
320312 ) -> "OptimizedModel" :
321313 """Overwrite this method in subclass to define how to load your model from vanilla hugging face model"""
@@ -328,32 +320,23 @@ def _export(
328320 def from_pretrained (
329321 cls ,
330322 model_id : Union [str , Path ],
323+ config : Optional [PretrainedConfig ] = None ,
331324 export : bool = False ,
332- force_download : bool = False ,
333- use_auth_token : Optional [Union [bool , str ]] = None ,
334- token : Optional [Union [bool , str ]] = None ,
335- cache_dir : str = HUGGINGFACE_HUB_CACHE ,
325+ # hub options
336326 subfolder : str = "" ,
337- config : Optional [PretrainedConfig ] = None ,
327+ revision : str = "main" ,
328+ force_download : bool = False ,
338329 local_files_only : bool = False ,
339330 trust_remote_code : bool = False ,
340- revision : Optional [str ] = None ,
331+ cache_dir : str = HUGGINGFACE_HUB_CACHE ,
332+ token : Optional [Union [bool , str ]] = None ,
341333 ** kwargs ,
342334 ) -> "OptimizedModel" :
343335 """
344336 Returns:
345337 `OptimizedModel`: The loaded optimized model.
346338 """
347339
348- if use_auth_token is not None :
349- warnings .warn (
350- "The `use_auth_token` argument is deprecated and will be removed soon. Please use the `token` argument instead." ,
351- FutureWarning ,
352- )
353- if token is not None :
354- raise ValueError ("You cannot use both `use_auth_token` and `token` arguments at the same time." )
355- token = use_auth_token
356-
357340 if isinstance (model_id , Path ):
358341 model_id = model_id .as_posix ()
359342
@@ -425,6 +408,7 @@ def from_pretrained(
425408 return from_pretrained_method (
426409 model_id = model_id ,
427410 config = config ,
411+ # hub options
428412 revision = revision ,
429413 cache_dir = cache_dir ,
430414 force_download = force_download ,
0 commit comments