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
bc9332b5
Unverified
Commit
bc9332b5
authored
Oct 26, 2020
by
Sam Shleifer
Committed by
GitHub
Oct 26, 2020
Browse files
[TF] from_pt should respect authorized_unexpected_keys (#8056)
parent
7ff7c493
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
src/transformers/modeling_tf_pytorch_utils.py
src/transformers/modeling_tf_pytorch_utils.py
+3
-0
No files found.
src/transformers/modeling_tf_pytorch_utils.py
View file @
bc9332b5
...
...
@@ -208,6 +208,9 @@ def load_pytorch_weights_in_tf2_model(tf_model, pt_state_dict, tf_inputs=None, a
if
tf_model
.
authorized_missing_keys
is
not
None
:
for
pat
in
tf_model
.
authorized_missing_keys
:
missing_keys
=
[
k
for
k
in
missing_keys
if
re
.
search
(
pat
,
k
)
is
None
]
if
tf_model
.
authorized_unexpected_keys
is
not
None
:
for
pat
in
tf_model
.
authorized_unexpected_keys
:
unexpected_keys
=
[
k
for
k
in
unexpected_keys
if
re
.
search
(
pat
,
k
)
is
None
]
if
len
(
unexpected_keys
)
>
0
:
logger
.
warning
(
...
...
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