Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
24178c24
Unverified
Commit
24178c24
authored
Oct 02, 2023
by
Younes Belkada
Committed by
GitHub
Oct 02, 2023
Browse files
[`PEFT`] Pass token when calling `find_adapter_config` (#26488)
* try * nit * nits
parent
7d6627d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+3
-1
src/transformers/models/auto/auto_factory.py
src/transformers/models/auto/auto_factory.py
+2
-0
No files found.
src/transformers/modeling_utils.py
View file @
24178c24
...
@@ -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
,
)
)
...
...
src/transformers/models/auto/auto_factory.py
View file @
24178c24
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment