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
b935639b
Commit
b935639b
authored
Dec 04, 2023
by
Christina Floristean
Browse files
Fix bugs in block deletion, disable for soloseq
parent
616de3df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
12 deletions
+19
-12
openfold/config.py
openfold/config.py
+2
-0
openfold/data/data_transforms.py
openfold/data/data_transforms.py
+17
-12
No files found.
openfold/config.py
View file @
b935639b
...
@@ -156,10 +156,12 @@ def model_config(
...
@@ -156,10 +156,12 @@ def model_config(
elif
name
==
"seqemb_initial_training"
:
elif
name
==
"seqemb_initial_training"
:
c
.
data
.
train
.
max_msa_clusters
=
1
c
.
data
.
train
.
max_msa_clusters
=
1
c
.
data
.
eval
.
max_msa_clusters
=
1
c
.
data
.
eval
.
max_msa_clusters
=
1
c
.
data
.
train
.
block_delete_msa
=
False
c
.
data
.
train
.
max_distillation_msa_clusters
=
1
c
.
data
.
train
.
max_distillation_msa_clusters
=
1
elif
name
==
"seqemb_finetuning"
:
elif
name
==
"seqemb_finetuning"
:
c
.
data
.
train
.
max_msa_clusters
=
1
c
.
data
.
train
.
max_msa_clusters
=
1
c
.
data
.
eval
.
max_msa_clusters
=
1
c
.
data
.
eval
.
max_msa_clusters
=
1
c
.
data
.
train
.
block_delete_msa
=
False
c
.
data
.
train
.
max_distillation_msa_clusters
=
1
c
.
data
.
train
.
max_distillation_msa_clusters
=
1
c
.
data
.
train
.
crop_size
=
384
c
.
data
.
train
.
crop_size
=
384
c
.
loss
.
violation
.
weight
=
1.
c
.
loss
.
violation
.
weight
=
1.
...
...
openfold/data/data_transforms.py
View file @
b935639b
...
@@ -253,28 +253,33 @@ def block_delete_msa(protein, config):
...
@@ -253,28 +253,33 @@ def block_delete_msa(protein, config):
*
config
.
msa_fraction_per_block
*
config
.
msa_fraction_per_block
).
to
(
torch
.
int32
)
).
to
(
torch
.
int32
)
if
int
(
block_num_seq
)
==
0
:
return
protein
if
config
.
randomize_num_blocks
:
if
config
.
randomize_num_blocks
:
nb
=
torch
.
distributions
.
uniform
.
Uniform
(
nb
=
int
(
torch
.
randint
(
0
,
config
.
num_blocks
+
1
low
=
0
,
).
sample
()
high
=
config
.
num_blocks
+
1
,
size
=
(
1
,),
device
=
protein
[
"msa"
].
device
,
)[
0
])
else
:
else
:
nb
=
config
.
num_blocks
nb
=
config
.
num_blocks
del_block_starts
=
torch
.
distributions
.
Uniform
(
0
,
num_seq
).
sample
(
nb
)
del_block_starts
=
torch
.
randint
(
low
=
1
,
high
=
num_seq
,
size
=
(
nb
,),
device
=
protein
[
"msa"
].
device
)
del_blocks
=
del_block_starts
[:,
None
]
+
torch
.
range
(
block_num_seq
)
del_blocks
=
del_block_starts
[:,
None
]
+
torch
.
a
range
(
start
=
0
,
end
=
block_num_seq
)
del_blocks
=
torch
.
clip
(
del_blocks
,
0
,
num_seq
-
1
)
del_blocks
=
torch
.
clip
(
del_blocks
,
1
,
num_seq
-
1
)
del_indices
=
torch
.
unique
(
torch
.
sort
(
torch
.
reshape
(
del_blocks
,
[
-
1
]))
)[
0
]
del_indices
=
torch
.
unique
(
torch
.
reshape
(
del_blocks
,
[
-
1
]))
# Make sure we keep the original sequence
# Make sure we keep the original sequence
combined
=
torch
.
cat
((
torch
.
range
(
1
,
num_seq
)
[
None
]
,
del_indices
[
None
])
)
combined
=
torch
.
cat
((
torch
.
a
range
(
start
=
0
,
end
=
num_seq
),
del_indices
)).
long
(
)
uniques
,
counts
=
combined
.
unique
(
return_counts
=
True
)
uniques
,
counts
=
combined
.
unique
(
return_counts
=
True
)
difference
=
uniques
[
counts
==
1
]
keep_indices
=
uniques
[
counts
==
1
]
intersection
=
uniques
[
counts
>
1
]
keep_indices
=
torch
.
squeeze
(
difference
,
0
)
assert
int
(
keep_indices
[
0
])
==
0
for
k
in
MSA_FEATURE_NAMES
:
for
k
in
MSA_FEATURE_NAMES
:
if
k
in
protein
:
if
k
in
protein
:
protein
[
k
]
=
torch
.
gather
(
protein
[
k
],
keep_indices
)
protein
[
k
]
=
torch
.
index_select
(
protein
[
k
],
0
,
keep_indices
)
return
protein
return
protein
...
...
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