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
61c7640c
"lib/llm/git@developer.sourcefind.cn:OpenDAS/dynamo.git" did not exist on "151a2a1de7b74cee5c81c716c246f4a40835d871"
Commit
61c7640c
authored
Sep 28, 2023
by
Geoffrey Yu
Browse files
move ground truth preparation out of process_tensors_from_config
parent
a9cf892f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
openfold/data/input_pipeline_multimer.py
openfold/data/input_pipeline_multimer.py
+11
-5
No files found.
openfold/data/input_pipeline_multimer.py
View file @
61c7640c
...
...
@@ -112,10 +112,21 @@ def ensembled_transform_fns(common_cfg, mode_cfg, ensemble_seed):
return
transforms
def
prepare_ground_truth_features
(
tensors
):
"""Prepare ground truth features that are only needed for loss calculation during training"""
GROUNDTRUTH_FEATURES
=
[
'all_atom_mask'
,
'all_atom_positions'
,
'asym_id'
,
'sym_id'
,
'entity_id'
]
gt_tensors
=
{
k
:
v
for
k
,
v
in
tensors
.
items
()
if
k
in
GROUNDTRUTH_FEATURES
}
gt_tensors
[
'aatype'
]
=
tensors
[
'aatype'
].
to
(
torch
.
long
)
gt_tensors
=
compose
(
grountruth_transforms_fns
())(
gt_tensors
)
return
gt_tensors
def
process_tensors_from_config
(
tensors
,
common_cfg
,
mode_cfg
,
is_training
=
False
):
"""Based on the config, apply filters and transformations to the data."""
if
is_training
:
gt_tensors
=
prepare_ground_truth_features
(
tensors
)
ensemble_seed
=
random
.
randint
(
0
,
torch
.
iinfo
(
torch
.
int32
).
max
)
tensors
[
'aatype'
]
=
tensors
[
'aatype'
].
to
(
torch
.
long
)
nonensembled
=
nonensembled_transform_fns
()
...
...
@@ -142,11 +153,6 @@ def process_tensors_from_config(tensors, common_cfg, mode_cfg,is_training=False)
)
if
is_training
:
GROUNDTRUTH_FEATURES
=
[
'all_atom_mask'
,
'all_atom_positions'
,
'asym_id'
,
'sym_id'
,
'entity_id'
]
gt_tensors
=
{
k
:
v
for
k
,
v
in
tensors
.
items
()
if
k
in
GROUNDTRUTH_FEATURES
}
gt_tensors
[
'aatype'
]
=
tensors
[
'aatype'
]
gt_tensors
=
compose
(
grountruth_transforms_fns
())(
gt_tensors
)
return
tensors
,
gt_tensors
else
:
return
tensors
...
...
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