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
OpenDAS
OpenFold
Commits
6625e8df
Commit
6625e8df
authored
Mar 16, 2023
by
Nikita Smetanin
Browse files
Improve TriangularMultiplicativeUpdate stability in fp16 mode
parent
7c32b79f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
openfold/model/triangular_multiplicative_update.py
openfold/model/triangular_multiplicative_update.py
+7
-2
No files found.
openfold/model/triangular_multiplicative_update.py
View file @
6625e8df
...
...
@@ -392,8 +392,13 @@ class TriangleMultiplicativeUpdate(nn.Module):
b
=
mask
b
=
b
*
self
.
sigmoid
(
self
.
linear_b_g
(
z
))
b
=
b
*
self
.
linear_b_p
(
z
)
if
(
is_fp16_enabled
()):
# Prevents overflow of torch.matmul in combine projections in
# reduced-precision modes
a
=
a
/
a
.
std
()
b
=
b
/
b
.
std
()
if
(
is_fp16_enabled
()):
with
torch
.
cuda
.
amp
.
autocast
(
enabled
=
False
):
x
=
self
.
_combine_projections
(
a
.
float
(),
b
.
float
())
else
:
...
...
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