Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
torchani
Commits
8203102c
Unverified
Commit
8203102c
authored
Sep 20, 2018
by
Gao, Xiang
Committed by
GitHub
Sep 20, 2018
Browse files
Allow neurochem-test.py to compare with TorchANI checkpoint file (#97)
parent
00e135ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
tools/neurochem-test.py
tools/neurochem-test.py
+14
-1
No files found.
tools/neurochem-test.py
View file @
8203102c
...
...
@@ -29,6 +29,8 @@ parser.add_argument('--sae_file',
parser
.
add_argument
(
'--network_dir'
,
help
=
'Directory or prefix of directories storing networks'
,
default
=
builtins
.
ensemble_prefix
+
'0/networks'
)
parser
.
add_argument
(
'--compare_with'
,
help
=
'The TorchANI model to compare with'
,
default
=
None
)
parser
=
parser
.
parse_args
()
# load modules and datasets
...
...
@@ -61,7 +63,7 @@ def hartree2kcal(x):
return
627.509
*
x
for
dataset
in
datasets
:
def
evaluate
(
dataset
,
container
)
:
evaluator
=
ignite
.
engine
.
create_supervised_evaluator
(
container
,
metrics
=
{
'RMSE'
:
torchani
.
ignite
.
RMSEMetric
(
'energies'
)
})
...
...
@@ -69,3 +71,14 @@ for dataset in datasets:
metrics
=
evaluator
.
state
.
metrics
rmse
=
hartree2kcal
(
metrics
[
'RMSE'
])
print
(
rmse
,
'kcal/mol'
)
for
dataset
in
datasets
:
evaluate
(
dataset
,
container
)
if
parser
.
compare_with
is
not
None
:
nn
.
load_state_dict
(
torch
.
load
(
parser
.
compare_with
))
print
(
'TorchANI results:'
)
for
dataset
in
datasets
:
evaluate
(
dataset
,
container
)
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