Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
fd0b94fd
Unverified
Commit
fd0b94fd
authored
Aug 24, 2023
by
Younes Belkada
Committed by
GitHub
Aug 24, 2023
Browse files
[`from_pretrained`] Fix failing PEFT tests (#25733)
fix failing PEFT tests
parent
1b2381c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+2
-1
No files found.
src/transformers/modeling_utils.py
View file @
fd0b94fd
...
@@ -2406,8 +2406,9 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
...
@@ -2406,8 +2406,9 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
_commit_hash
=
commit_hash
,
_commit_hash
=
commit_hash
,
)
)
if
_adapter_model_path
is
not
None
and
os
.
path
.
isfile
(
_adapter_model_path
):
if
_adapter_model_path
is
not
None
and
os
.
path
.
isfile
(
_adapter_model_path
):
with
open
(
_adapter_model_path
,
"r"
,
encoding
=
"utf-8"
):
with
open
(
_adapter_model_path
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
_adapter_model_path
=
pretrained_model_name_or_path
_adapter_model_path
=
pretrained_model_name_or_path
pretrained_model_name_or_path
=
json
.
load
(
f
)[
"base_model_name_or_path"
]
# change device_map into a map if we passed an int, a str or a torch.device
# change device_map into a map if we passed an int, a str or a torch.device
if
isinstance
(
device_map
,
torch
.
device
):
if
isinstance
(
device_map
,
torch
.
device
):
...
...
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