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
90f6e73a
"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "0083b149e9d69a2f1dcd380b42902c3c3e75d7af"
Unverified
Commit
90f6e73a
authored
Nov 09, 2019
by
eukaryote
Committed by
GitHub
Nov 09, 2019
Browse files
Add DialoGPT support for Pytorch->TF
parent
ef998529
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
transformers/modeling_tf_pytorch_utils.py
transformers/modeling_tf_pytorch_utils.py
+3
-0
No files found.
transformers/modeling_tf_pytorch_utils.py
View file @
90f6e73a
...
@@ -118,6 +118,9 @@ def load_pytorch_weights_in_tf2_model(tf_model, pt_state_dict, tf_inputs=None, a
...
@@ -118,6 +118,9 @@ def load_pytorch_weights_in_tf2_model(tf_model, pt_state_dict, tf_inputs=None, a
new_key
=
key
.
replace
(
'gamma'
,
'weight'
)
new_key
=
key
.
replace
(
'gamma'
,
'weight'
)
if
'beta'
in
key
:
if
'beta'
in
key
:
new_key
=
key
.
replace
(
'beta'
,
'bias'
)
new_key
=
key
.
replace
(
'beta'
,
'bias'
)
# DialoGPT format
if
key
==
'lm_head.decoder.weight'
:
new_key
=
'lm_head.weight'
if
new_key
:
if
new_key
:
old_keys
.
append
(
key
)
old_keys
.
append
(
key
)
new_keys
.
append
(
new_key
)
new_keys
.
append
(
new_key
)
...
...
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