Closed Cloudac7 closed 5 years ago
This is probably a bug in the code. When we update the code for pytorch 1.0, we forgot to update the predict.py. Thanks for pointing this out. We will fix it very soon.
See pull request #10 for possible fix.
Thanks @TanyaAdams1. @Cloudac7 Can you test if the fix solves the problem?
Thanks @TanyaAdams1. @Cloudac7 Can you test if the fix solves the problem?
=> loading model params 'pre-trained/formation-energy-per-atom.pth.tar'
=> loaded model params 'pre-trained/formation-energy-per-atom.pth.tar'
=> loading model 'pre-trained/formation-energy-per-atom.pth.tar'
=> loaded model 'pre-trained/formation-energy-per-atom.pth.tar' (epoch 968, validation 0.03972001800748568)
/opt/conda/lib/python3.6/site-packages/pymatgen/io/cif.py:1107: UserWarning: Issues encountered while parsing CIF
:
warnings.warn("Issues encountered while parsing CIF:")
/opt/conda/lib/python3.6/site-packages/pymatgen/io/cif.py:1109: UserWarning: Some fractional co-ordinates rounded
to ideal values to avoid finite precision errors.
warnings.warn(error)
Traceback (most recent call last):
File "predict.py", line 299, in <module>
main()
File "predict.py", line 102, in main
validate(test_loader, model, criterion, normalizer, test=True)
File "predict.py", line 154, in validate
losses.update(loss.data.cpu()[0], target.size(0))
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
I just tested the modified code, but it seems that the bug still exists.
I forgot to fix both regression and classification. Should be OK now. Please refer to #11
Yes, that should be the problem. I have merged the pull request. @Cloudac7 You can sync to the HEAD to get the latest code.
Yes, that should be the problem. I have merged the pull request. @Cloudac7 You can sync to the HEAD to get the latest code.
It works for the code in README. Thanks a lot for fixing the bug.
I configured the code in both docker and real environment, and there was not any error duIring excuting the training part. But for the predicting part, it raised the following error:
I used PyTorch 1.1 with CUDA10 in docker, while PyTorch 1.0 with CUDA 9.0 in real environment. The error was raised in both environment. So how could I deal with it?
Thanks!