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

[Feature Request] Add command to check the available model branches in multi-task pre-trained model. #3742

Closed
iProzd opened this issue May 6, 2024 · 0 comments · Fixed by #3796
Assignees

Comments

@iProzd
Copy link
Collaborator

iProzd commented May 6, 2024

Summary

Add command to check the available model branches in multi-task pre-trained model.

Detailed Description

See above.

Further Information, Files, and Links

No response

@iProzd iProzd self-assigned this May 6, 2024
github-merge-queue bot pushed a commit that referenced this issue May 29, 2024
…task pre-trained model(Issue #3742) (#3796)

Solve #3742
1. Situation one(The right way to use it):
`dp --pt show multitask_model.pt model-branch type-map descriptor
fitting-net`
`[2024-05-22 10:38:16,678] DEEPMD INFO    This is a multitask model`
`[2024-05-22 10:38:16,678] DEEPMD INFO Available model branches are
['MPtraj_v026_01-mix-Utype', 'MPtraj_v026_02-mix-Utype',
'MPtraj_v026_03-mix-Utype', 'MPtraj_v026_04-mix-Utype',
'MPtraj_v026_05-mix-Utype', 'MPtraj_v026_06-mix-Utype',
'MPtraj_v026_07-mix-Utype', 'MPtraj_v026_08-mix-Utype',
'MPtraj_v026_09-mix-Utype', 'MPtraj_v026_10-mix-Utype',
'MPtraj_v026_11-mix-Utype']`
`[2024-05-22 10:38:16,679] DEEPMD INFO The type_map of branch
MPtraj_v026_01-mix-Utype is ['H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O',
'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca',
'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge',
'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru',
'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', 'I', 'Xe', 'Cs', 'Ba',
'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er',
'Tm', 'Yb', 'Lu', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg',
'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn', 'Fr', 'Ra', 'Ac', 'Th', 'Pa', 'U',
'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm', 'Md', 'No', 'Lr', 'Rf',
'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn', 'Nh', 'Fl', 'Mc', 'Lv',
'Ts', 'Og', 'Co_U', 'Cr_U', 'Fe_U', 'Mn_U', 'Mo_U', 'Ni_U', 'V_U',
'W_U']`
(skip other branches' output)
`[2024-05-22 10:38:16,679] DEEPMD INFO The descriptor parameter of
branch MPtraj_v026_04-mix-Utype is {'type': 'dpa2', 'repinit':
{'tebd_dim': 256, 'rcut': 9.0, 'rcut_smth': 8.0, 'nsel': 120, 'neuron':
[25, 50, 100], 'axis_neuron': 12, 'activation_function': 'tanh'},
'repformer': {'rcut': 4.0, 'rcut_smth': 3.5, 'nsel': 40, 'nlayers': 12,
'g1_dim': 128, 'g2_dim': 32, 'attn2_hidden': 32, 'attn2_nhead': 4,
'attn1_hidden': 128, 'attn1_nhead': 4, 'axis_neuron': 4,
'activation_function': 'tanh', 'update_h2': False, 'update_g1_has_conv':
True, 'update_g1_has_grrg': True, 'update_g1_has_drrd': True,
'update_g1_has_attn': True, 'update_g2_has_g1g1': False,
'update_g2_has_attn': True, 'update_style': 'res_residual',
'update_residual': 0.01, 'update_residual_init': 'norm',
'attn2_has_gate': True}, 'add_tebd_to_repinit_out': False}`
(skip other branches' output)
`[2024-05-22 10:38:16,679] DEEPMD INFO The fitting_net parameter of
branch MPtraj_v026_01-mix-Utype is {'neuron': [240, 240, 240],
'activation_function': 'tanh', 'resnet_dt': True, 'seed': 1, '_comment':
" that's all"}`
(skip other branches' output)

2. Situation two (`singletask_model.pt` is not a multi-task pre-trained
model)
`dp --pt show singletask_model.pt model-branch type-map descriptor
fitting-net`
`[2024-05-22 10:43:11,642] DEEPMD INFO    This is a singletask model`
`RuntimeError: The 'model-branch' option requires a multitask model. The
provided model does not meet this criterion.`

3. Situation three(using tf backend)
`dp show multitask_model.pt model-branch`
`RuntimeError: unknown command list-model-branch`

4. Frozen model file with a .pth extension are used in the same way as
checkpoint file with a .pt extension.
`dp --pt show frozen_model.pth type-map descriptor fitting-net`
`[2024-05-22 10:46:26,365] DEEPMD INFO    This is a singletask model`
`[2024-05-22 10:46:26,365] DEEPMD INFO The type_map is ['H', 'He', 'Li',
'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S',
'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni',
'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr', 'Y', 'Zr',
'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te',
'I', 'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd',
'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu', 'Hf', 'Ta', 'W', 'Re', 'Os',
'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn', 'Fr', 'Ra',
'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm',
'Md', 'No', 'Lr', 'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn',
'Nh', 'Fl', 'Mc', 'Lv', 'Ts', 'Og', 'Co_U', 'Cr_U', 'Fe_U', 'Mn_U',
'Mo_U', 'Ni_U', 'V_U', 'W_U']`
`[2024-05-22 10:46:26,365] DEEPMD INFO The descriptor parameter is
{'type': 'dpa2', 'repinit': {'tebd_dim': 256, 'rcut': 9.0, 'rcut_smth':
8.0, 'nsel': 120, 'neuron': [25, 50, 100], 'axis_neuron': 12,
'activation_function': 'tanh'}, 'repformer': {'rcut': 4.0, 'rcut_smth':
3.5, 'nsel': 40, 'nlayers': 12, 'g1_dim': 128, 'g2_dim': 32,
'attn2_hidden': 32, 'attn2_nhead': 4, 'attn1_hidden': 128,
'attn1_nhead': 4, 'axis_neuron': 4, 'activation_function': 'tanh',
'update_h2': False, 'update_g1_has_conv': True, 'update_g1_has_grrg':
True, 'update_g1_has_drrd': True, 'update_g1_has_attn': True,
'update_g2_has_g1g1': False, 'update_g2_has_attn': True, 'update_style':
'res_residual', 'update_residual': 0.01, 'update_residual_init': 'norm',
'attn2_has_gate': True}, 'add_tebd_to_repinit_out': False}`
`[2024-05-22 10:46:26,365] DEEPMD INFO The fitting_net parameter is
{'neuron': [240, 240, 240], 'activation_function': 'tanh', 'resnet_dt':
True, 'seed': 1, '_comment': " that's all"}`

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

- **New Features**
- Introduced `--list-model-branch` command-line argument for listing
model branches of a multitask pretrained model.
- Added functionality to display model information based on specified
attributes.

- **Documentation**
- Updated documentation to include new command `--list-model-branch` for
checking available model branches in a multitask pre-trained model.

- **Tests**
- Added test cases for single-task and multi-task models, including
model configurations, training, and displaying model information for
checkpointed and frozen models.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Chenqqian Zhang <100290172+Chengqian-Zhang@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: Duo <50307526+iProzd@users.noreply.github.com>
Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com>
@njzjz njzjz closed this as completed May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
2 participants