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
32dd89bb
Commit
32dd89bb
authored
Aug 12, 2022
by
Brian Loyal
Browse files
Write the inference and relax times to file
parent
6e930a6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
run_pretrained_openfold.py
run_pretrained_openfold.py
+17
-1
No files found.
run_pretrained_openfold.py
View file @
32dd89bb
...
...
@@ -120,6 +120,7 @@ def run_model(model, batch, tag, args):
out
=
model
(
batch
)
inference_time
=
time
.
perf_counter
()
-
t
logger
.
info
(
f
"Inference time:
{
inference_time
}
"
)
update_timings
({
"inference"
:
inference_time
},
os
.
path
.
join
(
args
.
output_dir
,
"timings.json"
))
model
.
config
.
template
.
enabled
=
template_enabled
...
...
@@ -480,7 +481,10 @@ def main(args):
os
.
environ
[
"CUDA_VISIBLE_DEVICES"
]
=
device_no
relaxed_pdb_str
,
_
,
_
=
amber_relaxer
.
process
(
prot
=
unrelaxed_protein
)
os
.
environ
[
"CUDA_VISIBLE_DEVICES"
]
=
visible_devices
logger
.
info
(
f
"Relaxation time:
{
time
.
perf_counter
()
-
t
}
"
)
relaxation_time
=
time
.
perf_counter
()
-
t
logger
.
info
(
f
"Relaxation time:
{
relaxation_time
}
"
)
update_timings
({
"relaxation"
:
relaxation_time
},
os
.
path
.
join
(
args
.
output_dir
,
"timings.json"
))
# Save the relaxed PDB.
relaxed_output_path
=
os
.
path
.
join
(
...
...
@@ -500,6 +504,18 @@ def main(args):
logger
.
info
(
f
"Model output written to
{
output_dict_path
}
..."
)
def
update_timings
(
dict
,
output_file
=
os
.
path
.
join
(
os
.
getcwd
(),
"timings.json"
)):
"""Write dictionary of one or more run step times to a file"""
import
json
if
os
.
path
.
exists
(
output_file
):
with
open
(
output_file
,
"r"
)
as
f
:
timings
=
json
.
loads
(
f
)
else
:
timings
=
{}
timings
.
update
(
dict
)
with
open
(
output_file
,
"w"
)
as
f
:
timings
.
dumps
(
f
)
return
output_file
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
...
...
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