Closed resnant closed 9 months ago
Hi @resnant, sorry for the late reply. We just added the training example for M3GNet formation energy model. You can take it as a reference. Please let me know if any further questions and I will close this issue. Thanks!
Thank you! It really helps us. I confirmed that the notebook works in our environment.
FYI, I found two tiny modifications are needed to run the code with a GPU, in addition to set accelerator="gpu".
At the beginning of the code, add the following line to set the default device to CUDA:
import torch
torch.set_default_device("cuda")
Specify num_workers=0
and pass the generator in the DataLoader settings like this:
train_loader, val_loader, test_loader = MGLDataLoader(
train_data=train_data,
val_data=val_data,
test_data=test_data,
collate_fn=my_collate_fn,
batch_size=2,
num_workers=0,
generator=torch.Generator(device="cuda:0")
)
I'm not sure if this is the expected behavior. I will look into the code later.
@resnant Yes, you will need to set the default device if using CUDA. I already wrote a short tutorial on modifications for CUDA use in the documentation.
Thank you for pointing that out. I had overlooked the tutorial. I appreciate your reminder.
Email (Optional)
Problem
I would like to request the inclusion of an example demonstrating the M3GNet training for property prediction. Currently, there's no dedicated example available. I attempted to adapt the MEGNet example(
examples/Training a MEGNet Formation Energy Model with PyTorch Lightning.ipynb
) for M3GNet, but I encountered errors and unexpected issues during this process.Proposed Solution
Please add an example notebook (or concise code snippet) demonstrating training M3GNet for property prediction. This addition will greatly assist users like me looking to utilize M3GNet for material property prediction tasks.
Alternatives
No response
Code of Conduct