Ramprasad-Group / polygnn

polyGNN is a Python library to automate ML model training for polymer informatics.
Other
30 stars 5 forks source link

Debugging Matrix Multiplication Error #8

Closed oliverhvidsten closed 1 year ago

oliverhvidsten commented 1 year ago

I am getting a matrix multiplication error that is a few layers down in the code. Currently it is trying to multiply a 50x128 matrix by a 129x64 matrix. I am assuming the correct multiplication dimension length is 128, but I am not sure what to do to make this happen.

I was wondering what the best way was to figure out what is causing this error and how to fix it.

Error pasted here: Traceback (most recent call last): File "GNN_training.py", line 281, in optimal_capacity = session.choose_model_size_by_overfit() File "/home/oliver/.cache/pypoetry/virtualenvs/polygnn-5wmT02iB-py3.7/lib/python3.7/site-packages/nndebugger/dl_debug.py", line 387, in choose_model_size_by_overfit start=start, File "/home/oliver/.cache/pypoetry/virtualenvs/polygnn-5wmT02iB-py3.7/lib/python3.7/site-packages/nndebugger/torch_utils.py", line 72, in default_per_epoch_trainer output = model(data) File "/home/oliver/.cache/pypoetry/virtualenvs/polygnn-5wmT02iB-py3.7/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, kwargs) File "/data/oliver/polygnn/polygnn/models.py", line 63, in forward x = self.final_mlp(x) # hidden layers File "/home/oliver/.cache/pypoetry/virtualenvs/polygnn-5wmT02iB-py3.7/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, *kwargs) File "/home/oliver/.cache/pypoetry/virtualenvs/polygnn-5wmT02iB-py3.7/lib/python3.7/site-packages/polygnn_trainer/layers.py", line 106, in forward x = layer(x) File "/home/oliver/.cache/pypoetry/virtualenvs/polygnn-5wmT02iB-py3.7/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(input, kwargs) File "/home/oliver/.cache/pypoetry/virtualenvs/polygnn-5wmT02iB-py3.7/lib/python3.7/site-packages/polygnn_trainer/layers.py", line 41, in forward return self.dropout(self.activation(self.linear(x))) File "/home/oliver/.cache/pypoetry/virtualenvs/polygnn-5wmT02iB-py3.7/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "/home/oliver/.cache/pypoetry/virtualenvs/polygnn-5wmT02iB-py3.7/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 114, in forward return F.linear(input, self.weight, self.bias) RuntimeError: mat1 and mat2 shapes cannot be multiplied (50x128 and 129x64)

rishigurnani commented 1 year ago

@oliverhvidsten Does this issue help you? https://github.com/Ramprasad-Group/polygnn/issues/3

oliverhvidsten commented 1 year ago

That was very helpful. Thank you. I now see that there are closed issues.