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

[BUG] se_atten error with FP32 #2311

Closed
njzjz opened this issue Feb 10, 2023 · 0 comments · Fixed by #2312
Closed

[BUG] se_atten error with FP32 #2311

njzjz opened this issue Feb 10, 2023 · 0 comments · Fixed by #2312
Assignees
Labels

Comments

@njzjz
Copy link
Member

njzjz commented Feb 10, 2023

Bug summary

Error is thrown when using se_atten with setting precision.

DeePMD-kit Version

v2.2.0b1.dev38+gd777c88e.d20230202

TensorFlow Version

2.9.0

How did you download the software?

Built from source

Input Files, Running Commands, Error Log, etc.

Traceback (most recent call last):
  File "/home/jz748/anaconda3/envs/deepmd/bin/dp", line 33, in <module>
    sys.exit(load_entry_point('deepmd-kit', 'console_scripts', 'dp')())
  File "/home/jz748/codes/deepmd-kit/deepmd/entrypoints/main.py", line 594, in main
    train_dp(**dict_args)
  File "/home/jz748/codes/deepmd-kit/deepmd/entrypoints/train.py", line 123, in train
    _do_work(jdata, run_opt, is_compress)
  File "/home/jz748/codes/deepmd-kit/deepmd/entrypoints/train.py", line 200, in _do_work
    model.build(train_data, stop_batch, origin_type_map=origin_type_map)
  File "/home/jz748/codes/deepmd-kit/deepmd/train/trainer.py", line 449, in build
    self._build_network(data, suffix)
  File "/home/jz748/codes/deepmd-kit/deepmd/train/trainer.py", line 476, in _build_network
    = self.model.build (self.place_holders['coord'], 
  File "/home/jz748/codes/deepmd-kit/deepmd/model/ener.py", line 174, in build
    dout = self.build_descrpt(
  File "/home/jz748/codes/deepmd-kit/deepmd/model/model.py", line 121, in build_descrpt
    = self.descrpt.build(coord_,
  File "/home/jz748/codes/deepmd-kit/deepmd/descriptor/se_atten.py", line 330, in build
    self.dout, self.qmat = self._pass_filter(self.descrpt_reshape,
  File "/home/jz748/codes/deepmd-kit/deepmd/descriptor/se_atten.py", line 359, in _pass_filter
    layer, qmat = self._filter(inputs_i, type_i, natoms, name='filter_type_all' + suffix, suffix=suffix,
  File "/home/jz748/codes/deepmd-kit/deepmd/common.py", line 440, in wrapper
    returned_tensor = func(
  File "/home/jz748/codes/deepmd-kit/deepmd/descriptor/se_atten.py", line 732, in _filter
    xyz_scatter_1 = self._filter_lower(
  File "/home/jz748/codes/deepmd-kit/deepmd/descriptor/se_atten.py", line 683, in _filter_lower
    self._attention_layers(xyz_scatter, self.attn_layer, shape_i, outputs_size, input_r,
  File "/home/jz748/codes/deepmd-kit/deepmd/descriptor/se_atten.py", line 600, in _attention_layers
    input_att = self._scaled_dot_attn(Q_c, K_c, V_c, sd_k, input_r, dotr=dotr, do_mask=do_mask, layer=i)
  File "/home/jz748/codes/deepmd-kit/deepmd/descriptor/se_atten.py", line 521, in _scaled_dot_attn
    attn *= self.nmask
  File "/home/jz748/anaconda3/envs/deepmd/lib/python3.9/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/home/jz748/anaconda3/envs/deepmd/lib/python3.9/site-packages/tensorflow/python/framework/op_def_library.py", line 590, in _ExtractInputsAndAttrs
    raise TypeError(
TypeError: Input 'y' of 'Mul' Op has type float64 that does not match type float32 of argument 'x'.

Steps to Reproduce

Use the input file in the examples/water/se_atten and set the precision to float32, then

dp train input.json

Further Information, Files, and Links

No response

@njzjz njzjz added the bug label Feb 10, 2023
iProzd added a commit to iProzd/deepmd-kit that referenced this issue Feb 11, 2023
@njzjz njzjz linked a pull request Feb 11, 2023 that will close this issue
wanghan-iapcm pushed a commit that referenced this issue Feb 13, 2023
Fix bug #2311 when using FP32 in se_atten
@njzjz njzjz closed this as completed Feb 13, 2023
dingye18 added a commit to dingye18/deepmd-kit that referenced this issue Feb 17, 2023
* print MAE for `dp test` (deepmodeling#2310)

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Fix bug deepmodeling#2311 when using FP32 in se_atten (deepmodeling#2312)

Fix bug deepmodeling#2311 when using FP32 in se_atten

* support multiple frames DeepPot in C/hpp API (deepmodeling#2309)

* Add DeepPot C API v2 to support multiple frames. Also, preserve the
arguments for fparam and aparam for future use (planned in deepmodeling#2236). V1 is
kept for API and ABI compatibility.
* Support multiple frames for DeepPot hpp API. The API compatibility is
kept. Add tests for new situation.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>

* Implementation of se_a_mask op (deepmodeling#2313)

* Implement se_a_mask op. Training and inference (c++ interface) are
tested. Unit test files are required.

* Fix bug in atom pref setting for forces.

* Add the unit test for descrpt se_a_mask

* Remove the unit test for dp mask model

* Update dp mask system path for unit test

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* support exclude_types for se_atten (deepmodeling#2315)

Fix deepmodeling#2232.

Also, clean old useless codes for `exclude_types`.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>

* fix restarting from the original model (deepmodeling#2317)

deepmodeling#2253 supports restarting from the compressed model but breaks the
original model. This PR fixes the error by detecting the model type
first.

```
FAILED_PRECONDITION: Attempting to use uninitialized value
```

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>

* package dp_ipi in the PyPI wheels (deepmodeling#2320)

Fix deepmodeling#2282.

In addition, change the return code of `dp_ipi` (without any arguments)
from 1 to 0.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* build Docker images for each push (deepmodeling#2324)

and push the image to the GitHub container.

Also, provide the pypi CUDA support for pypi LAMMPS.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>

* Fix typo in install docs (deepmodeling#2325)

Signed-off-by: Chun Cai <amoycaic@gmail.com>

* Add a script to detect model version (deepmodeling#2318)

This PR adds a script in deepmd/utils to detect the version of a Deep
Potential model.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Chun Cai <amoycaic@gmail.com>
Co-authored-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Duo <50307526+iProzd@users.noreply.github.com>
Co-authored-by: Chun Cai <amoycaic@gmail.com>
Co-authored-by: Yifan Li李一帆 <yifanl0716@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants