'ASEAtomsData' object has no attribute 'prepare_data_per_node'
Closed this issue · 7 comments
After making a custom dataset using tutorial in git, and further trying to traing schnet to predict atom energy i get this exception
AttributeError: 'ASEAtomsData' object has no attribute 'prepare_data_per_node'
Hi @hekaido ,
could you please provide more information?
In particular, how exactly are you training schnet?
In case you are using a config file, please provide that to us.
Furthermore, it would be helpful if you could provide information about the installed packages in your python environment. In particular pytorch-lightning, pytorch, and ase.
Best, Jonas
Hi @jnsLs
At first I have structures parsed from aflow dataset. I'm creating a custom dataset using tutorial at
examples/tutorials/tutorial_01_preparing_data.ipynb. Then I use a examples/tutorials/tutorial_03_force_models.ipynb to train a schnet for predicting energy of parsed structures. The problem occurs after trying to start training with pytorch-lightning trainer module and proving as datamodule argument my custom dataset
trainer.fit(task, datamodule=new_dataset)
AttributeError: 'ASEAtomsData' object has no attribute 'prepare_data_per_node'
You can checkout my notebook for further information:
https://colab.research.google.com/drive/1KI3jABjEmcYQAsjs5hU4MEhzLdMKz9j5?usp=sharing
Best, Nikita
Hi @hekaido ,
for training you should use spk.data.AtomsDataModule
instead of ASEAtomsData
.
Here is a template:
import schnetpack as spk
import schnetpack.transform as trn
custom_data = spk.data.AtomsDataModule(
'./new_dataset.db',
batch_size=10,
distance_unit='Ang',
property_units={'energy':'kcal/mol', 'forces':'kcal/mol/Ang'},
num_train=1000,
num_val=100,
transforms=[
trn.ASENeighborList(cutoff=5.),
trn.RemoveOffsets(MD17.energy, remove_mean=True, remove_atomrefs=False),
trn.CastTo32()
],
num_workers=1,
pin_memory=True, # set to false, when not using a GPU
)
custom_data.prepare_data()
custom_data.setup()
In general, training models is easier using the command line interface (CLI) described in the README.md file.
Best, Jonas
Hi @hekaido , for training you should use
spk.data.AtomsDataModule
instead ofASEAtomsData
. Here is a template:
...
FWIW, I had the same issue today and this solved it.
We updated (#562 ) the tutorial. I hope it is more clear now!