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
2f2793f4
Commit
2f2793f4
authored
Jul 18, 2023
by
Geoffrey Yu
Browse files
added an extra step because sometimes the boolean value will change into a pytorch tensor
parent
566ca1a3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
openfold/model/model.py
openfold/model/model.py
+4
-1
No files found.
openfold/model/model.py
View file @
2f2793f4
...
...
@@ -535,7 +535,10 @@ class AlphaFold(nn.Module):
# Enable grad iff we're training and it's the final recycling layer
is_final_iter
=
cycle_no
==
(
num_iters
-
1
)
or
early_stop
with
torch
.
set_grad_enabled
(
is_grad_enabled
and
is_final_iter
):
enable_grad
=
is_grad_enabled
and
is_final_iter
if
(
type
(
enable_grad
)
!=
bool
)
and
(
type
(
enable_grad
)
==
torch
.
Tensor
):
enable_grad
=
enable_grad
.
item
()
with
torch
.
set_grad_enabled
(
enable_grad
):
if
is_final_iter
:
# Sidestep AMP bug (PyTorch issue #65766)
if
torch
.
is_autocast_enabled
():
...
...
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