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] multi-task example does not work #4358

Closed
ChiahsinChu opened this issue Nov 14, 2024 · 3 comments · Fixed by #4360
Closed

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

ChiahsinChu opened this issue Nov 14, 2024 · 3 comments · Fixed by #4360
Labels

Comments

@ChiahsinChu
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Member

njzjz commented Nov 15, 2024

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

@wanghan-iapcm
Copy link
Collaborator

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

wanghan-iapcm pushed a commit that referenced this issue Nov 19, 2024
)

Currently, the multi-task cannot work correctly, and an error is thrown.
(See #4358 for more details)
To fix this bug, a minor change in `DeepmdDataSystem` is made to make
the property `default_mesh` editable.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced a new attribute for caching default mesh values, improving
efficiency.
- Added functionality to set test size as a percentage of total
structures.
- New method for automated test size calculation based on specified
percentages.

- **Deprecations**
- Marked the `get_test` method as deprecated, shifting to a new approach
for accessing test data.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

3 participants