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
a309459b
Commit
a309459b
authored
May 22, 2019
by
Chris
Browse files
fn change; pytorch_model_dir required=False
parent
69749f3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
2 deletions
+1
-2
pytorch_pretrained_bert/convert_pytorch_checkpoint_to_tf.py
pytorch_pretrained_bert/convert_pytorch_checkpoint_to_tf.py
+1
-2
No files found.
pytorch_pretrained_bert/convert_h
f
_checkpoint_to_tf.py
→
pytorch_pretrained_bert/convert_
pytorc
h_checkpoint_to_tf.py
View file @
a309459b
...
@@ -56,7 +56,6 @@ def convert_hf_checkpoint_to_tf(model:type(BertModel), ckpt_dir:str):
...
@@ -56,7 +56,6 @@ def convert_hf_checkpoint_to_tf(model:type(BertModel), ckpt_dir:str):
name
=
name
.
replace
(
'LayerNorm/weight'
,
'LayerNorm/gamma'
)
name
=
name
.
replace
(
'LayerNorm/weight'
,
'LayerNorm/gamma'
)
name
=
name
.
replace
(
'LayerNorm/bias'
,
'LayerNorm/beta'
)
name
=
name
.
replace
(
'LayerNorm/bias'
,
'LayerNorm/beta'
)
name
=
name
.
replace
(
'weight'
,
'kernel'
)
name
=
name
.
replace
(
'weight'
,
'kernel'
)
# name += ':0'
return
'bert/{}'
.
format
(
name
)
return
'bert/{}'
.
format
(
name
)
def
assign_tf_var
(
tensor
:
np
.
ndarray
,
name
:
str
):
def
assign_tf_var
(
tensor
:
np
.
ndarray
,
name
:
str
):
...
@@ -86,7 +85,7 @@ if __name__ == "__main__":
...
@@ -86,7 +85,7 @@ if __name__ == "__main__":
parser
.
add_argument
(
"--pytorch_model_dir"
,
parser
.
add_argument
(
"--pytorch_model_dir"
,
default
=
None
,
default
=
None
,
type
=
str
,
type
=
str
,
required
=
Tru
e
,
required
=
Fals
e
,
help
=
"Directory containing pytorch model"
)
help
=
"Directory containing pytorch model"
)
parser
.
add_argument
(
"--pytorch_model_name"
,
parser
.
add_argument
(
"--pytorch_model_name"
,
default
=
None
,
default
=
None
,
...
...
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