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
00a09ed4
"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "0919389d9aa03c19bee2ae9bc9922ff15ec8381b"
Commit
00a09ed4
authored
Mar 25, 2024
by
Arthur Zucker
Browse files
fix
😭
parent
8e9a2207
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+3
-1
No files found.
src/transformers/modeling_utils.py
View file @
00a09ed4
...
@@ -600,7 +600,9 @@ def _load_state_dict_into_model(model_to_load, state_dict, start_prefix):
...
@@ -600,7 +600,9 @@ def _load_state_dict_into_model(model_to_load, state_dict, start_prefix):
# so we need to apply the function recursively.
# so we need to apply the function recursively.
def
load
(
module
:
nn
.
Module
,
state_dict
,
prefix
=
""
):
def
load
(
module
:
nn
.
Module
,
state_dict
,
prefix
=
""
):
local_metadata
=
{}
if
metadata
is
None
else
metadata
.
get
(
prefix
[:
-
1
],
{})
local_metadata
=
{}
if
metadata
is
None
else
metadata
.
get
(
prefix
[:
-
1
],
{})
args
=
(
state_dict
,
prefix
,
local_metadata
,
True
,
[],
[],
error_msgs
)
unexpected_keys
=
[]
missing_keys
=
[]
args
=
(
state_dict
,
prefix
,
local_metadata
,
True
,
missing_keys
,
unexpected_keys
,
error_msgs
)
# Parameters of module and children will start with prefix. We can exit early if there are none in this
# Parameters of module and children will start with prefix. We can exit early if there are none in this
# state_dict
# state_dict
if
len
([
key
for
key
in
state_dict
if
key
.
startswith
(
prefix
)])
>
0
:
if
len
([
key
for
key
in
state_dict
if
key
.
startswith
(
prefix
)])
>
0
:
...
...
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