-
|
I'm working on using a float32 model in CP2K (cp2k/cp2k#4716) and I noticed that a float32 model outputs the Should I interpret this as float64 atomic_energies are converted back to float32 and then the gradient of the float32 atomic_energies is used to produce the forces in float32? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hi @krarmd , I would expect all inputs and outputs (energies, forces) of the model to be in float64 even if the model internals are in float32. How are you inspecting this behavior? If there is a reproducer, I can try to look into it. |
Beta Was this translation helpful? Give feedback.
I may have found the culprit. CP2K was setting the positions as float32 because the model dtype was float32. I think that was a remnant of the previous NequiP code structure. I am able to get
Doubleprecision for forces and atomic_energy by disabling CP2K's conversion of the positions from double to single precision which may be how theforceswere being set to float32 in theForceStressOutputfunction. Thanks for confirming that forces and atomic_energies should be in float64, it helped me trace the issue back to CP2K.