Skip to content

Commit

Permalink
[PEFT] Pass token when calling find_adapter_config (#26488)
Browse files Browse the repository at this point in the history
* try

* nit

* nits
  • Loading branch information
younesbelkada authored Oct 2, 2023
1 parent 7d6627d commit 24178c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/transformers/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2480,6 +2480,9 @@ def from_pretrained(
)
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():
use_safetensors = False

Expand Down Expand Up @@ -2526,7 +2529,6 @@ def from_pretrained(
resume_download=resume_download,
proxies=proxies,
local_files_only=local_files_only,
token=token,
_commit_hash=commit_hash,
**adapter_kwargs,
)
Expand Down
2 changes: 2 additions & 0 deletions src/transformers/models/auto/auto_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
if is_peft_available():
if adapter_kwargs is None:
adapter_kwargs = {}
if token is not None:
adapter_kwargs["token"] = token

maybe_adapter_path = find_adapter_config_file(
pretrained_model_name_or_path, _commit_hash=commit_hash, **adapter_kwargs
Expand Down

0 comments on commit 24178c2

Please sign in to comment.