File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ def load_adapter(
106106 low_cpu_mem_usage : bool = False ,
107107 is_trainable : bool = False ,
108108 hotswap : bool | Literal ["auto" ] = "auto" ,
109+ local_files_only : bool = False ,
109110 adapter_kwargs : Optional [dict [str , Any ]] = None ,
110111 ) -> None :
111112 """
@@ -237,6 +238,9 @@ def load_adapter(
237238 if adapter_kwargs is None :
238239 adapter_kwargs = {}
239240
241+ if "local_files_only" not in adapter_kwargs :
242+ adapter_kwargs ["local_files_only" ] = local_files_only
243+
240244 from peft import PeftConfig , inject_adapter_in_model , load_peft_weights
241245 from peft .utils import set_peft_model_state_dict
242246
@@ -768,6 +772,9 @@ def maybe_load_adapters(
768772):
769773 if pretrained_model_name_or_path is None or not is_peft_available ():
770774 return None , pretrained_model_name_or_path , adapter_kwargs
775+
776+ if "local_files_only" not in adapter_kwargs :
777+ adapter_kwargs ["local_files_only" ] = download_kwargs .get ("local_files_only" , False )
771778
772779 token = download_kwargs .get ("token" )
773780
Original file line number Diff line number Diff line change @@ -687,12 +687,14 @@ def pipeline(
687687
688688 code_revision = kwargs .pop ("code_revision" , None )
689689 commit_hash = kwargs .pop ("_commit_hash" , None )
690+ local_files_only = kwargs .get ("local_files_only" , False )
690691
691692 hub_kwargs = {
692693 "revision" : revision ,
693694 "token" : token ,
694695 "trust_remote_code" : trust_remote_code ,
695696 "_commit_hash" : commit_hash ,
697+ "local_files_only" : local_files_only ,
696698 }
697699
698700 if task is None and model is None :
You can’t perform that action at this time.
0 commit comments