Eikor / InstructPLM

The first large protein language model trained follows structure instructions.
Apache License 2.0
71 stars 5 forks source link

RuntimeError: shape '[-1, 1152]' is invalid for input of size 49896 #1

Closed weitinging closed 6 months ago

weitinging commented 6 months ago

I'm getting the following RuntimeError when trying to run 'python structure_embeddings/preprocess.py'.

Traceback (most recent call last): File "structure_embeddings/preprocess.py", line 316, in <module> write_pyd() File "structure_embeddings/preprocess.py", line 312, in write_pyd record = process_mpnn_embedding_fn(record) File "structure_embeddings/preprocess.py", line 167, in process_mpnn_embedding_fn sample["mpnn_emb"] = mpnn_emb1.view(-1, 1152).cpu() RuntimeError: shape '[-1, 1152]' is invalid for input of size 49896

The issue seems to stem from the dimensions of mpnn_emb1. For the file Fast-PETase.pdb, the dimension of mpnn_emb11 is torch.Size([1, 264, 21]). mpnn_emb1 concatenates the output of 9 models, resulting in a dimension of torch.Size([1, 264, 189]). The error arises when executing sample["mpnn_emb"] = mpnn_emb1.view(-1, 1152).cpu(), as the dimension is not an integral multiple of 1152.

Eikor commented 6 months ago

The size "21" seems like the prob of 21 amino acids, see https://github.com/chq1155/ProteinMPNN/blob/2d2bccc7301d1369d95e53fd6d0d77c03dd785b3/protein_mpnn_utils.py#L1113C27-L1113C30. I guess you have received the wrong return value.

weitinging commented 6 months ago

Sorry for my mistake, and now I could successfully construct structure embeddings. Thank you for your reply.