-
Notifications
You must be signed in to change notification settings - Fork 78
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] Vector output from TensorNet #297
Comments
Hi! Thanks a lot for your interest, I can see that you have gone in depth through the TensorNet paper! Regarding the new feature, you absolutely got it right. In fact we think it is an enhancement, and it will facilitate the use of vector features from TensorNet to other users that are not that familiar with the formalism. Therefore, we propose you to open a PR. Some things:
I think it is more consistent with the way we perform vector_to_skewtensor [..., whatever, 3] to [..., whatever, 3, 3].
Thanks again, feel free to open the PR. Guillem |
Sorry for not clearing this. I raised this issue because some papers choose to train with predicting equivariant vector as forces (instead of autograd of energy wrt to positions). This seems to be computationally faster, so if you're pretraining you can do this and then during fine-tuning use autograd based loss (reference: section 4 of https://arxiv.org/pdf/2310.16802.pdf). rot = # rotation matrix
energy, forces = net(atomic_numbers, positions, batch)
energy_rot, forces_rot = net(atomic_numbers, positions @ rot, batch)
assert torch.allclose(forces @ rot, forces) # since equivariant
assert torch.allclose(energy, energy_rot) # since invariant Let me start a PR. |
Feature Request
Currently the vector output is set to
None
. This could be easily calculated based on skew symmetric matrix based on the paper. Some papers suggest using force prediction using equivariant heads, so this would be required for that if TensorNet is used as a representation module.We can add the following function in order to do it,
And in the line
torchmd-net/torchmdnet/models/tensornet.py
Line 271 in fdd4dac
do,
It might be useful if someone wants to use an
EquivariantScalar
orEquivariantVectorOutput
modules on top ofTensorNet
.I tested for equivariance with the EquivariantVectorOutput Module and it does work out.
Would this be right? If yes, I can also add a test.
The text was updated successfully, but these errors were encountered: