-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bondnet not training or predicting #1
Comments
Hi @ABehal2020 This seems to be a |
I followed these instructions in the bondnet branch in this rxnrep repo as I would like to use the update bondnet: git clone https://github.com/mjwen/rxnrep.git My torchmetrics subsequently was 0.9.3 - I downgraded by running the following: conda install torchmetrics=0.6.2 I then tried to train the model by running the following: (rxnrep) Adityas-MacBook-Pro:rxnrep adityabehal$ python run.py model/decoder=regressor.yaml datamodule=regression/electrolyte.yaml After installing wandb, I reran the training command: python run.py model/decoder=regressor.yaml This gave me another stack trace: (rxnrep) Adityas-MacBook-Pro:rxnrep adityabehal$ python run.py model/decoder=regressor.yaml datamodule=regression/electrolyte.yaml Global seed set to 35 I appreciate any help. Thank you! |
I believe these 3 JSON files need to be pushed to the bondnet branch for rxnrep repo for local training to work on my computer: trainset_filename: /Users/mjwen/Documents/Dataset/electrolyte/reactions_n2000_train.json Thank you! |
ah, thanks for catching this! Just added the dataset to the repo. Please pull the latest |
Thanks for the detailed info. |
Thanks! I updated my local rxnrep folder with the latest bondnet branch changes. New stack trace when running model training command locally on my Mac (prediction on pretrained model works): |
Modify electrolyte.yaml to set the |
Thanks! Local training works now. I'd like to use my locally trained model to make predictions. When I train the model and then run prediction, here's the output: (rxnrep) Adityas-MacBook-Pro:rxnrep adityabehal$ bondnet examples/reactions_mrnet.json Find model directory I believe it is still using the pretrained model that was pulled earlier from Google Drive. How can I make the predict command use the locally trained model? |
Yes, it is using the pretrained model. Instructions to your own model added to README. |
Thanks! I updated the datamodule/regression/electrolyte.yaml file local paths to point to the train, test, and validation mrnet files on my computer. I have a few questions:
Traceback (most recent call last): |
It is correct behavior to see only one test error, because test is only performed at the ending of the training using the best performing model. Also, the test error is the mean absolute error for the entire test set. So, if you want to get prediction error for each individual points, you will need to use the
In training deep neural nets, we train in mini batches, the global step corresponds to the number of mini batch steps. Alternatively, you can also view the epochs (i.e. the number of iterations of passing your training data) by choosing it from the upper right dropdown from the wandb interface.
Have no immediate idea why this happens. Some guesses: 1. did you |
Thank you for all your help! |
Hi, I really love rxnrep's bondnet implementation, and I've enjoyed working with it so far. I have a couple more questions:
(rxnrep) cary-50:rxnrep adityabehal$ bondnet /Users/adityabehal/Documents/RPI/RCOS/IBM-ML-Chemistry/rxnrep/examples/reactions_mrnet.json --model /Users/adityabehal/Documents/RPI/RCOS/IBM-ML-Chemistry/rxnrep/outputs/2022-11-04-smiles It was working earlier, but after some update to the bondnet branch of this rxnrep repo, it's not working and I'm not sure if this is an issue on my end.
I got the following stack trace: [2022-11-04 17:38:57,788][/Users/adityabehal/Documents/RPI/RCOS/IBM-ML-Chemistry/rxnrep/rxnrep/train.py][INFO] - Instantiating datamodule: rxnrep.data.nrel.NRELDataModule The above exception was the direct cause of the following exception: Traceback (most recent call last): I'm wondering if rxnrep can predict individual molecular properties as is or if I'll need to modify it to do so. I've attached a zip file of the test, train, and val solubility dataset tsv files I'm passing in Thank you for all your help so far! |
|
// using locally trained mrnet model for prediction on mrnet data (will it work with smiles data too?)
|
Models trained using smiles can be used for mrnet and vice versa. In prediction, we need to initialize the model and then load the trained model. But the default parameters (e.g. atom feature dimension) for smiles and mrnet input are different, then you see the More specifically, take a look at this and this. They need to be updated to be the same, and then it should work. And, thanks for the dataset source! |
Thank you - I have some questions about smiles string formatting.
|
I followed the instructions in the GitHub repo bondnet branch to use the updated version of bondnet.
When I tried to train, I get the following error:
(rxnrep) Adityas-MacBook-Pro:rxnrep adityabehal$ python run.py model/decoder=regressor.yaml datamodule=regression/electrolyte.yaml
Traceback (most recent call last):
File "run.py", line 6, in
from rxnrep.train import train
File "/Users/adityabehal/Documents/RPI/RCOS/IBM-quantum-computing/rxnrep/rxnrep/train.py", line 7, in
from pytorch_lightning import (
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/pytorch_lightning/init.py", line 20, in
from pytorch_lightning import metrics # noqa: E402
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/pytorch_lightning/metrics/init.py", line 15, in
from pytorch_lightning.metrics.classification import ( # noqa: F401
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/pytorch_lightning/metrics/classification/init.py", line 14, in
from pytorch_lightning.metrics.classification.accuracy import Accuracy # noqa: F401
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/pytorch_lightning/metrics/classification/accuracy.py", line 18, in
from pytorch_lightning.metrics.utils import deprecated_metrics
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/pytorch_lightning/metrics/utils.py", line 22, in
from torchmetrics.utilities.data import get_num_classes as _get_num_classes
ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data' (/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/torchmetrics/utilities/data.py)
When I try to predict, I get the following error (I assume if the model is not trained locally then it should default to the pretrained version?):
(rxnrep) Adityas-MacBook-Pro:rxnrep adityabehal$ bondnet examples/reactions_mrnet.json
Traceback (most recent call last):
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/bin/bondnet", line 33, in
sys.exit(load_entry_point('rxnrep', 'console_scripts', 'bondnet')())
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/bin/bondnet", line 25, in importlib_load_entry_point
return next(matches).load()
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/Users/adityabehal/Documents/RPI/RCOS/IBM-quantum-computing/rxnrep/predict.py", line 15, in
from rxnrep.data.electrolyte import ElectrolyteDataset
File "/Users/adityabehal/Documents/RPI/RCOS/IBM-quantum-computing/rxnrep/rxnrep/data/electrolyte.py", line 9, in
from rxnrep.data.datamodule import (
File "/Users/adityabehal/Documents/RPI/RCOS/IBM-quantum-computing/rxnrep/rxnrep/data/datamodule.py", line 5, in
from pytorch_lightning import LightningDataModule
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/pytorch_lightning/init.py", line 20, in
from pytorch_lightning import metrics # noqa: E402
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/pytorch_lightning/metrics/init.py", line 15, in
from pytorch_lightning.metrics.classification import ( # noqa: F401
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/pytorch_lightning/metrics/classification/init.py", line 14, in
from pytorch_lightning.metrics.classification.accuracy import Accuracy # noqa: F401
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/pytorch_lightning/metrics/classification/accuracy.py", line 18, in
from pytorch_lightning.metrics.utils import deprecated_metrics
File "/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/pytorch_lightning/metrics/utils.py", line 22, in
from torchmetrics.utilities.data import get_num_classes as _get_num_classes
ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data' (/Users/adityabehal/opt/anaconda3/envs/rxnrep/lib/python3.8/site-packages/torchmetrics/utilities/data.py)
The text was updated successfully, but these errors were encountered: