Skip to content

Commit

Permalink
Avoid loading/padding forces when not needed (#463)
Browse files Browse the repository at this point in the history
* cleanup

* move forces to additional_properties

* fix typo
  • Loading branch information
farhadrgh authored May 1, 2020
1 parent 4f30aae commit de9020d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
6 changes: 5 additions & 1 deletion examples/nnp_training_force.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@

batch_size = 2560

training, validation = torchani.data.load(dspath).subtract_self_energies(energy_shifter).species_to_indices(species_order).shuffle().split(0.8, None)
training, validation = torchani.data.load(
dspath,
additional_properties=('forces',)
).subtract_self_energies(energy_shifter).species_to_indices(species_order).shuffle().split(0.8, None)

training = training.collate(batch_size).cache()
validation = validation.collate(batch_size).cache()

Expand Down
7 changes: 0 additions & 7 deletions tests/test_jit_builtin_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

path = os.path.dirname(os.path.realpath(__file__))
dspath = os.path.join(path, '../dataset/ani-1x/sample.h5')
batch_size = 256
chunk_threshold = 5
other_properties = {'properties': ['energies'],
'padding_values': [None],
'padded_shapes': [(batch_size, )],
'dtypes': [torch.float64],
}


class TestBuiltinModelsJIT(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion torchani/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
verbose = True


PROPERTIES = ('energies', 'forces')
PROPERTIES = ('energies',)
PADDING = {
'species': -1,
'coordinates': 0.0,
Expand Down

0 comments on commit de9020d

Please sign in to comment.