Unverified Commit 24178c24 authored by Younes Belkada's avatar Younes Belkada Committed by GitHub
Browse files

[`PEFT`] Pass token when calling `find_adapter_config` (#26488)

* try

* nit

* nits
parent 7d6627d0
...@@ -2480,6 +2480,9 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix ...@@ -2480,6 +2480,9 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
) )
token = use_auth_token token = use_auth_token
if token is not None and "token" not in adapter_kwargs:
adapter_kwargs["token"] = token
if use_safetensors is None and not is_safetensors_available(): if use_safetensors is None and not is_safetensors_available():
use_safetensors = False use_safetensors = False
...@@ -2526,7 +2529,6 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix ...@@ -2526,7 +2529,6 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
resume_download=resume_download, resume_download=resume_download,
proxies=proxies, proxies=proxies,
local_files_only=local_files_only, local_files_only=local_files_only,
token=token,
_commit_hash=commit_hash, _commit_hash=commit_hash,
**adapter_kwargs, **adapter_kwargs,
) )
......
...@@ -498,6 +498,8 @@ class _BaseAutoModelClass: ...@@ -498,6 +498,8 @@ class _BaseAutoModelClass:
if is_peft_available(): if is_peft_available():
if adapter_kwargs is None: if adapter_kwargs is None:
adapter_kwargs = {} adapter_kwargs = {}
if token is not None:
adapter_kwargs["token"] = token
maybe_adapter_path = find_adapter_config_file( maybe_adapter_path = find_adapter_config_file(
pretrained_model_name_or_path, _commit_hash=commit_hash, **adapter_kwargs pretrained_model_name_or_path, _commit_hash=commit_hash, **adapter_kwargs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment