-
Notifications
You must be signed in to change notification settings - Fork 537
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
[BUG] Incorrect results from DPLR model in python inference interface #4625
Comments
deepmd-kit/deepmd/tf/infer/deep_eval.py Line 764 in 70bc6d8
This line seems wrong; it should be |
However, I don't understand why this test can pass: |
Yes, but there should be more than this. I tried temporality to remove this condition but it still did not work. The problem seems to come from the impropriate initialisation of the |
Where did the reference data come from? When I tried to run this test in v2.2.11, I got the error about the missing dipole model, which makes sense to me: Traceback (most recent call last):
File "/home/jxzhu/workspace/test/test.py", line 7, in <module>
dp = DeepPot("lrmodel.pb")
File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/infer/deep_pot.py", line 205, in __init__
self.dm = DipoleChargeModifier(
File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/infer/data_modifier.py", line 61, in __init__
DeepDipole.__init__(
File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/infer/deep_dipole.py", line 58, in __init__
DeepTensor.__init__(
File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/infer/deep_tensor.py", line 71, in __init__
DeepEval.__init__(
File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/infer/deep_eval.py", line 64, in __init__
self.graph = self._load_graph(
File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/infer/deep_eval.py", line 189, in _load_graph
graph_def.ParseFromString(f.read())
File "/home/jxzhu/apps/miniconda3/envs/deepmd-v2.2.11/lib/python3.10/site-packages/tensorflow/python/lib/io/file_io.py", line 114, in read
self._preread_check()
File "/home/jxzhu/apps/miniconda3/envs/deepmd-v2.2.11/lib/python3.10/site-packages/tensorflow/python/lib/io/file_io.py", line 76, in _preread_check
self._read_buf = _pywrap_file_io.BufferedInputStream(
tensorflow.python.framework.errors_impl.NotFoundError: lrdipole.pb; No such file or directory In other words, the v3 code does not try to load the dipole model... |
It comes from #2545. |
I see. I checked the orginal test in v2, and found that the reference data used in the UT in v3 is actually the sr term. That explains it. |
I see. Ideally it should reproduce the following result. deepmd-kit/source/lmp/tests/test_dplr.py Lines 128 to 138 in bab9258
|
Bug summary
In deepmd v3, the inference results from the DPLR model are incorrect when using the Python interface. In deepmd-v3, the long-range correction (i.e., the data modifier) is not calculated and added to the final results. It should be relevant to the change in architecture in the inference module.
DeePMD-kit Version
DeePMD-kit v3.0.1
Backend and its version
TensorFlow v2.18.0-rc2-4-g6550e4bd802
How did you download the software?
pip
Input Files, Running Commands, Error Log, etc.
Test python script for v2:
Output:
Test python script for v3:
Output:
In both cases, the energies from data modifier are identical. However, the total energy in v3 = the total energy in v2 + the energy of data modifier.
Steps to Reproduce
Please download the attached models and run the scripts above with deepmd v2/v3.
Further Information, Files, and Links
H2O_dplr_model.zip
The text was updated successfully, but these errors were encountered: