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
7c9402d0
Unverified
Commit
7c9402d0
authored
Aug 13, 2018
by
Gao, Xiang
Committed by
GitHub
Aug 13, 2018
Browse files
preprocess data on CPU to save cuda memory (#64)
parent
50fb6cdb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
examples/training-benchmark.py
examples/training-benchmark.py
+1
-1
torchani/training/data.py
torchani/training/data.py
+8
-1
No files found.
examples/training-benchmark.py
View file @
7c9402d0
...
...
@@ -16,7 +16,7 @@ parser.add_argument('-d', '--device',
default
=
(
'cuda'
if
torch
.
cuda
.
is_available
()
else
'cpu'
))
parser
.
add_argument
(
'--batch_size'
,
help
=
'Number of conformations of each batch'
,
default
=
1024
,
type
=
int
)
default
=
256
,
type
=
int
)
parser
=
parser
.
parse_args
()
# set up benchmark
...
...
torchani/training/data.py
View file @
7c9402d0
...
...
@@ -23,6 +23,7 @@ class BatchedANIDataset(Dataset):
self
.
properties
=
properties
self
.
dtype
=
dtype
self
.
device
=
device
device
=
torch
.
device
(
'cpu'
)
# get name of files storing data
files
=
[]
...
...
@@ -85,7 +86,13 @@ class BatchedANIDataset(Dataset):
self
.
batches
=
batches
def
__getitem__
(
self
,
idx
):
return
self
.
batches
[
idx
]
(
species
,
coordinates
),
properties
=
self
.
batches
[
idx
]
species
=
species
.
to
(
self
.
device
)
coordinates
=
coordinates
.
to
(
self
.
device
)
properties
=
{
k
:
properties
[
k
].
to
(
self
.
device
)
for
k
in
properties
}
return
(
species
,
coordinates
),
properties
def
__len__
(
self
):
return
len
(
self
.
batches
)
...
...
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