deepmodeling / deepmd-kit

A deep learning package for many-body potential energy representation and molecular dynamics
https://docs.deepmodeling.com/projects/deepmd/
GNU Lesser General Public License v3.0
1.5k stars 513 forks source link

[BUG] multi-task example does not work #4358

Open ChiahsinChu opened 4 days ago

ChiahsinChu commented 4 days ago

Bug summary

The example for multi-task does not work and gets an errors when calculating neighbour statistics.

DeePMD-kit Version

DeePMD-kit v2.2.11

Backend and its version

TensorFlow v2.10.0

How did you download the software?

Built from source

Input Files, Running Commands, Error Log, etc.

Input files: deepmd-kit/examples/water_multi_task/ener_dipole

Running command:

dp train input.json

Error log:

DEEPMD INFO    Calculate neighbor statistics... (add --skip-neighbor-stat to skip this step)
Traceback (most recent call last):
  File "/home/jxzhu/apps/miniconda3/envs/deepmd-v2.2.11/bin/dp", line 8, in <module>
    sys.exit(main())
  File "/home/jxzhu/apps/deepmd/2.2.11/deepmd_utils/main.py", line 657, in main
    deepmd_main(args)
  File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/entrypoints/main.py", line 74, in main
    train_dp(**dict_args)
  File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/entrypoints/train.py", line 149, in train
    jdata = update_sel(jdata)
  File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/entrypoints/train.py", line 512, in update_sel
    jdata_cpy["model"] = Model.update_sel(jdata, jdata["model"])
  File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/model/model.py", line 566, in update_sel
    return cls.update_sel(global_jdata, local_jdata)
  File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/model/multi.py", line 663, in update_sel
    local_jdata_cpy["descriptor"] = Descriptor.update_sel(
  File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/descriptor/descriptor.py", line 510, in update_sel
    return cls.update_sel(global_jdata, local_jdata)
  File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/descriptor/se.py", line 158, in update_sel
    return update_one_sel(global_jdata, local_jdata_cpy, False)
  File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/entrypoints/train.py", line 479, in update_one_sel
    tmp_sel = get_sel(
  File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/entrypoints/train.py", line 440, in get_sel
    _, max_nbor_size = get_nbor_stat(jdata, rcut, one_type=one_type)
  File "/home/jxzhu/apps/deepmd/2.2.11/deepmd/entrypoints/train.py", line 415, in get_nbor_stat
    train_data.default_mesh += tmp_data.default_mesh
AttributeError: can't set attribute 'default_mesh'

Steps to Reproduce

# install deepmd-v2.2.11
git clone -b v2.2.11 https://github.com/deepmodeling/deepmd-kit.git 
cd deepmd-kit/examples/water_multi_task/ener_dipole
dp train input.json

Further Information, Files, and Links

No response

ChiahsinChu commented 3 days ago

This can be resolved with a minor change in DeepmdDataSystem, but I cannot find the corresponding devel branch for v2 and PR the changes.

njzjz commented 3 days ago

You can submit to the r2 branch. v3 will be released soon and r2 will not be the default branch anymore.

wanghan-iapcm commented 14 minutes ago

Please note that in v3 we will remove the support of multi-task training in the tf backend.