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
56b86074
Unverified
Commit
56b86074
authored
Jun 17, 2023
by
Dingquan Yu
Committed by
GitHub
Jun 17, 2023
Browse files
Merge pull request #1 from aqlaboratory/main
Fix batched finetuning bugs
parents
103d0370
55003f16
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
openfold/utils/loss.py
openfold/utils/loss.py
+5
-2
openfold/utils/validation_metrics.py
openfold/utils/validation_metrics.py
+1
-1
train_openfold.py
train_openfold.py
+3
-2
No files found.
openfold/utils/loss.py
View file @
56b86074
...
...
@@ -1353,7 +1353,10 @@ def violation_loss(
+
l_clash
)
return
loss
# Average over the batch dimension
mean
=
torch
.
mean
(
loss
)
return
mean
def
compute_renamed_ground_truth
(
...
...
@@ -1476,7 +1479,7 @@ def experimentally_resolved_loss(
)
->
torch
.
Tensor
:
errors
=
sigmoid_cross_entropy
(
logits
,
all_atom_mask
)
loss
=
torch
.
sum
(
errors
*
atom37_atom_exists
,
dim
=-
1
)
loss
=
loss
/
(
eps
+
torch
.
sum
(
atom37_atom_exists
,
dim
=
(
-
1
,
-
2
)))
loss
=
loss
/
(
eps
+
torch
.
sum
(
atom37_atom_exists
,
dim
=
(
-
1
,
-
2
))
.
unsqueeze
(
-
1
)
)
loss
=
torch
.
sum
(
loss
,
dim
=-
1
)
loss
=
loss
*
(
...
...
openfold/utils/validation_metrics.py
View file @
56b86074
...
...
@@ -29,7 +29,7 @@ def drmsd(structure_1, structure_2, mask=None):
if
(
mask
is
not
None
):
drmsd
=
drmsd
*
(
mask
[...,
None
]
*
mask
[...,
None
,
:])
drmsd
=
torch
.
sum
(
drmsd
,
dim
=
(
-
1
,
-
2
))
n
=
d1
.
shape
[
-
1
]
if
mask
is
None
else
torch
.
sum
(
mask
,
dim
=-
1
)
n
=
d1
.
shape
[
-
1
]
if
mask
is
None
else
torch
.
min
(
torch
.
sum
(
mask
,
dim
=-
1
)
)
drmsd
=
drmsd
*
(
1
/
(
n
*
(
n
-
1
)))
if
n
>
1
else
(
drmsd
*
0.
)
drmsd
=
torch
.
sqrt
(
drmsd
)
...
...
train_openfold.py
View file @
56b86074
...
...
@@ -88,9 +88,10 @@ class OpenFoldWrapper(pl.LightningModule):
)
for
k
,
v
in
other_metrics
.
items
():
assert
(
len
(
v
.
shape
)
==
1
)
self
.
log
(
f
"
{
phase
}
/
{
k
}
"
,
v
,
f
"
{
phase
}
/
{
k
}
"
,
torch
.
mean
(
v
),
on_step
=
False
,
on_epoch
=
True
,
logger
=
True
)
...
...
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