Skip to content
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

RuntimeError: mat1 and mat2 shapes cannot be multiplied #3

Open
bii-dpi opened this issue Nov 16, 2024 · 0 comments
Open

RuntimeError: mat1 and mat2 shapes cannot be multiplied #3

bii-dpi opened this issue Nov 16, 2024 · 0 comments

Comments

@bii-dpi
Copy link

bii-dpi commented Nov 16, 2024

Running the AttentionSiteDTI-based example on the Human dataset as found within README.md produces the following error in the "testing" phase after data processing: RuntimeError: mat1 and mat2 shapes cannot be multiplied (29x405 and 666x50)

The full printed output is as follows; note the Desired structure doesn't exist warnings which might be related to the issue:

Processing: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 138/138 [00:03<00:00, 42.52it/s]
Preprocessing SMILES from smile to graph is done.
Processing:   5%|██████                                                                                                                | 5/98 [00:08<01:54,  1.23s/it](_preprocess_and_save_data_point pid=123783) Desired structure doesn't exist
Processing:  15%|█████████████████▉                                                                                                   | 15/98 [00:14<00:49,  1.68it/s](_preprocess_and_save_data_point pid=123783) Desired structure doesn't exist
Processing:  84%|█████████████████████████████████████████████████████████████████████████████████████████████████▉                   | 82/98 [00:48<00:08,  1.94it/s](_preprocess_and_save_data_point pid=123785) Desired structure doesn't exist
Processing: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 98/98 [01:00<00:00,  1.61it/s]
Preprocessing pdb_id from pdb_id to binding_pocket_graph is done.
Preprocessing Label done.
Processing: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 22/22 [00:03<00:00,  7.06it/s]
Preprocessing SMILES from smile to graph is done.
Processing: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6/6 [00:06<00:00,  1.04s/it]
Preprocessing pdb_id from pdb_id to binding_pocket_graph is done.
Preprocessing Label done.
Processing: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 24/24 [00:03<00:00,  7.66it/s]
Preprocessing SMILES from smile to graph is done.
Processing: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 13/13 [00:09<00:00,  1.37it/s]
Preprocessing pdb_id from pdb_id to binding_pocket_graph is done.
Preprocessing Label done.
Testing:   0%|                                                                                                                                  | 0/2 [00:01<?, ?it/s]
Traceback (most recent call last):
  File "path/to/your/project/tmp.py", line 49, in <module>
    print(model.evaluate(data_loader_val, device,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "path/to/your/project/attentionsitedti.py", line 448, in evaluate
    out = self.forward(d, p)
          ^^^^^^^^^^^^^^^^^^
  File "path/to/your/project/attentionsitedti.py", line 333, in forward
    ligand_rep = self.drug_encoder(drug)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "path/to/env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "path/to/env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "path/to/your/project/graph_conv.py", line 63, in forward
    graph = layer(graph)
            ^^^^^^^^^^^^
  File "path/to/env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "path/to/env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "path/to/env/lib/python3.11/site-packages/dgl/nn/pytorch/conv/tagconv.py", line 145, in forward
    rst = self.lin(th.cat(fstack, dim=-1))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "path/to/env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "path/to/env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "path/to/env/lib/python3.11/site-packages/torch/nn/modules/linear.py", line 117, in forward
    return F.linear(input, self.weight, self.bias)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: mat1 and mat2 shapes cannot be multiplied (29x405 and 666x50)

(tmp.py refers to the script I created directly based on the example from README.md)

Python Version: 3.11
Relevant Packages:
dgl: 2.4.0
torch: 2.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant