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

[Feature Request] pt: support virtual types #3297

Closed
njzjz opened this issue Feb 19, 2024 · 0 comments · Fixed by #3469
Closed

[Feature Request] pt: support virtual types #3297

njzjz opened this issue Feb 19, 2024 · 0 comments · Fixed by #3469
Assignees
Milestone

Comments

@njzjz
Copy link
Member

njzjz commented Feb 19, 2024

Virtual types are not supported in pt; thus, mixed-natoms input is not supported.

For example, given the following atomic types:

frame 0: 0 0 0 0 0
frame 1: 0 0 0 -1 -1

The atomic type of the second frame is equivalent to [0, 0, 0].

The current behavior is that an error is thrown:

E             File "/home/jz748/codes/deepmd-kit/deepmd/pt/model/descriptor/dpa1.py", line 196, in forward
E                   nframes, nloc, nnei = nlist.shape
E                   nall = extended_coord.view(nframes, -1).shape[1] // 3
E                   g1_ext = self.type_embedding(extended_atype)
E                            ~~~~~~~~~~~~~~~~~~~ <--- HERE
E                   g1_inp = g1_ext[:, :nloc, :]
E                   g1, g2, h2, rot_mat, sw = self.se_atten(
E             File "/home/jz748/codes/deepmd-kit/deepmd/pt/model/network/network.py", line 568, in forward
E               
E                   """
E                   return self.embedding(atype)
E                          ~~~~~~~~~~~~~~ <--- HERE
E             File "/home/jz748/anaconda3/lib/python3.10/site-packages/torch/nn/modules/sparse.py", line 163, in forward
E               def forward(self, input: Tensor) -> Tensor:
E                   return F.embedding(
E                          ~~~~~~~~~~~ <--- HERE
E                       input, self.weight, self.padding_idx, self.max_norm,
E                       self.norm_type, self.scale_grad_by_freq, self.sparse)
E             File "/home/jz748/anaconda3/lib/python3.10/site-packages/torch/nn/functional.py", line 2237, in embedding
E                   # remove once script supports set_grad_enabled
E                   _no_grad_embedding_renorm_(weight, input, max_norm, norm_type)
E               return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
E                      ~~~~~~~~~~~~~~~ <--- HERE
E           RuntimeError: index out of range in self
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

2 participants