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
a8d896fd
Commit
a8d896fd
authored
Sep 14, 2023
by
Christina Floristean
Browse files
Fix seq min length issue in kernel test
parent
e9898a60
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
20 deletions
+16
-20
environment.yml
environment.yml
+1
-1
tests/config.py
tests/config.py
+1
-1
tests/test_deepspeed_evo_attention.py
tests/test_deepspeed_evo_attention.py
+14
-18
No files found.
environment.yml
View file @
a8d896fd
...
...
@@ -28,6 +28,6 @@ dependencies:
-
wandb==0.12.21
-
modelcif==0.7
-
git+https://github.com/NVIDIA/dllogger.git
-
git+https://github.com/
microsoft
/DeepSpeed.git
-
git+https://github.com/
cctry
/DeepSpeed.git
# TODO: Replace above when version becomes available
# - deepspeed==0.10.4
tests/config.py
View file @
a8d896fd
...
...
@@ -3,7 +3,7 @@ import ml_collections as mlc
consts
=
mlc
.
ConfigDict
(
{
"batch_size"
:
2
,
"n_res"
:
20
,
"n_res"
:
11
,
"n_seq"
:
13
,
"n_templ"
:
3
,
"n_extra"
:
17
,
...
...
tests/test_deepspeed_evo_attention.py
View file @
a8d896fd
...
...
@@ -27,14 +27,8 @@ from openfold.model.primitives import (
)
from
tests.config
import
consts
import
tests.compare_utils
as
compare_utils
from
tests.data_utils
import
(
random_template_feats
,
random_extra_msa_feats
,
)
from
openfold.config
import
model_config
from
openfold.data
import
data_transforms
from
openfold.model.model
import
AlphaFold
from
openfold.utils.tensor_utils
import
tensor_tree_map
...
...
@@ -70,8 +64,8 @@ class TestDeepSpeedKernel(unittest.TestCase):
Set dtype to confirm the kernel can be used during both training (BF16) and inference (FP32),
since the kernel itself can run with either BF16 or FP16 precision.
"""
n_res
=
consts
.
n_res
n_seq
=
consts
.
n_seq
n_res
=
20
n_seq
=
18
eps
=
2e-2
activations
=
{
...
...
@@ -156,6 +150,7 @@ class TestDeepSpeedKernel(unittest.TestCase):
batch
=
tensor_tree_map
(
move_dim
,
batch
)
with
torch
.
no_grad
():
with
torch
.
cuda
.
amp
.
autocast
(
dtype
=
torch
.
bfloat16
):
model
=
compare_utils
.
get_global_pretrained_openfold
()
out_repro
=
model
(
batch
)
...
...
@@ -169,7 +164,8 @@ class TestDeepSpeedKernel(unittest.TestCase):
out_repro
=
out_repro
[
"sm"
][
"positions"
][
-
1
].
squeeze
(
0
)
out_repro_ds
=
out_repro_ds
[
"sm"
][
"positions"
][
-
1
].
squeeze
(
0
)
self
.
assertTrue
(
torch
.
max
(
torch
.
abs
(
out_repro
-
out_repro_ds
))
<
eps
)
err
=
torch
.
max
(
torch
.
abs
(
out_repro
-
out_repro_ds
))
self
.
assertTrue
(
err
<
eps
,
f
'Error:
{
err
}
'
)
if
__name__
==
"__main__"
:
...
...
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