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
fd5eac5f
Unverified
Commit
fd5eac5f
authored
Oct 18, 2022
by
Matt
Committed by
GitHub
Oct 18, 2022
Browse files
Small fixes for TF-ESM1b and ESM-1b weight conversions (#19683)
parent
90071fe4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
src/transformers/models/esm/convert_esm.py
src/transformers/models/esm/convert_esm.py
+1
-1
src/transformers/models/esm/modeling_tf_esm.py
src/transformers/models/esm/modeling_tf_esm.py
+1
-1
No files found.
src/transformers/models/esm/convert_esm.py
View file @
fd5eac5f
...
...
@@ -149,7 +149,7 @@ def convert_esm_checkpoint_to_pytorch(
self_attn
.
value
.
weight
.
data
=
esm_layer
.
self_attn
.
v_proj
.
weight
self_attn
.
value
.
bias
.
data
=
esm_layer
.
self_attn
.
v_proj
.
bias
if
has
attr
(
esm_layer
.
self_attn
,
"rot_emb"
)
:
if
get
attr
(
esm_layer
.
self_attn
,
"rot_emb"
,
None
)
is
not
None
:
# Matt: Although inv_freq is not a trainable weight, it is computed at model init and cached.
# During the training of ESM-2 the model was converted to float16 precision, which also converts
# the inv_freq tensor, and the loss of precision remains even if the model is loaded later as float32.
...
...
src/transformers/models/esm/modeling_tf_esm.py
View file @
fd5eac5f
...
...
@@ -136,7 +136,7 @@ class TFEsmEmbeddings(Layer):
)
if
config
.
emb_layer_norm_before
:
self
.
layer_norm
=
LayerNormalization
(
epsilon
=
config
.
layer_norm_eps
)
self
.
layer_norm
=
LayerNormalization
(
epsilon
=
config
.
layer_norm_eps
,
name
=
"layer_norm"
)
else
:
self
.
layer_norm
=
None
# Matt: I think this line was copied incorrectly from BERT, disabling for now
...
...
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