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
torchani
Commits
d7302cc3
"tests/kernels/cache.py" did not exist on "cbf8779afafdaba2ddc6e2212d67c40f1b6e11fd"
Unverified
Commit
d7302cc3
authored
Dec 16, 2020
by
Ignacio Pickering
Committed by
GitHub
Dec 16, 2020
Browse files
deactivate autograd during validation (#560)
parent
d3847898
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
examples/nnp_training.py
examples/nnp_training.py
+10
-7
examples/nnp_training_force.py
examples/nnp_training_force.py
+10
-7
No files found.
examples/nnp_training.py
View file @
d7302cc3
...
...
@@ -294,6 +294,8 @@ def validate():
mse_sum
=
torch
.
nn
.
MSELoss
(
reduction
=
'sum'
)
total_mse
=
0.0
count
=
0
model
.
train
(
False
)
with
torch
.
no_grad
():
for
properties
in
validation
:
species
=
properties
[
'species'
].
to
(
device
)
coordinates
=
properties
[
'coordinates'
].
to
(
device
).
float
()
...
...
@@ -301,6 +303,7 @@ def validate():
_
,
predicted_energies
=
model
((
species
,
coordinates
))
total_mse
+=
mse_sum
(
predicted_energies
,
true_energies
).
item
()
count
+=
predicted_energies
.
shape
[
0
]
model
.
train
(
True
)
return
hartree2kcalmol
(
math
.
sqrt
(
total_mse
/
count
))
...
...
examples/nnp_training_force.py
View file @
d7302cc3
...
...
@@ -208,6 +208,8 @@ def validate():
mse_sum
=
torch
.
nn
.
MSELoss
(
reduction
=
'sum'
)
total_mse
=
0.0
count
=
0
model
.
train
(
False
)
with
torch
.
no_grad
():
for
properties
in
validation
:
species
=
properties
[
'species'
].
to
(
device
)
coordinates
=
properties
[
'coordinates'
].
to
(
device
).
float
()
...
...
@@ -215,6 +217,7 @@ def validate():
_
,
predicted_energies
=
model
((
species
,
coordinates
))
total_mse
+=
mse_sum
(
predicted_energies
,
true_energies
).
item
()
count
+=
predicted_energies
.
shape
[
0
]
model
.
train
(
True
)
return
hartree2kcalmol
(
math
.
sqrt
(
total_mse
/
count
))
...
...
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