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
d5064953
Unverified
Commit
d5064953
authored
Aug 30, 2021
by
Li-Huai (Allan) Lin
Committed by
GitHub
Aug 30, 2021
Browse files
Check None before going through iteration (#13250)
* Check None before going through iteration * Format
parent
774760e6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
src/transformers/trainer.py
src/transformers/trainer.py
+3
-1
No files found.
src/transformers/trainer.py
View file @
d5064953
...
@@ -1411,7 +1411,9 @@ class Trainer:
...
@@ -1411,7 +1411,9 @@ class Trainer:
load_result
=
self
.
model
.
load_state_dict
(
state_dict
,
strict
=
False
)
load_result
=
self
.
model
.
load_state_dict
(
state_dict
,
strict
=
False
)
if
len
(
load_result
.
missing_keys
)
!=
0
:
if
len
(
load_result
.
missing_keys
)
!=
0
:
if
set
(
load_result
.
missing_keys
)
==
set
(
self
.
model
.
_keys_to_ignore_on_save
):
if
self
.
model
.
_keys_to_ignore_on_save
is
not
None
and
set
(
load_result
.
missing_keys
)
==
set
(
self
.
model
.
_keys_to_ignore_on_save
):
self
.
model
.
tie_weights
()
self
.
model
.
tie_weights
()
else
:
else
:
logger
.
warn
(
f
"There were missing keys in the checkpoint model loaded:
{
load_result
.
missing_keys
}
."
)
logger
.
warn
(
f
"There were missing keys in the checkpoint model loaded:
{
load_result
.
missing_keys
}
."
)
...
...
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