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

Replace string search with API call in freeze function #3713

Closed
coderabbitai bot opened this issue Apr 26, 2024 · 3 comments · Fixed by #3851
Closed

Replace string search with API call in freeze function #3713

coderabbitai bot opened this issue Apr 26, 2024 · 3 comments · Fixed by #3851
Assignees
Milestone

Comments

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 26, 2024

In the function of , the model type is currently determined by searching for a string in . This method is not robust and could lead to errors if the string format changes. It is suggested to replace this string search with a dedicated API call that can more reliably determine the model type.

Affected code:

if '"type": "dpa2"' in model.model_def_script:

This issue was identified in PR #3657 and discussed in the comments: #3657 (comment)

@njzjz
Copy link
Member

njzjz commented Jun 2, 2024

There may be two options:
(1) add a method has_message_passing like the existing mixed_types methods;
(2) add a general bitwise feature method that works for any method which returns a bool, including mixed_types, has_message_passing, and any new feature in the future.

@wanghan-iapcm @iProzd What do you think about it?

@wanghan-iapcm
Copy link
Collaborator

I vote for (1).
I don't see obvious advantage of using (2) over (1).

@iProzd
Copy link
Collaborator

iProzd commented Jun 3, 2024

Agree with @wanghan-iapcm.

@njzjz njzjz linked a pull request Jun 4, 2024 that will close this issue
github-merge-queue bot pushed a commit that referenced this issue Jun 6, 2024
Fix #3713. Fix #3733. This is a breaking change.

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

- **New Features**
- Introduced a new method `has_message_passing` across various
descriptor classes. This method returns a boolean indicating whether the
descriptor has message passing capability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
@njzjz njzjz closed this as completed Jun 6, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in DeePMD-3.0.0 beta release Jun 6, 2024
mtaillefumier pushed a commit to mtaillefumier/deepmd-kit that referenced this issue Sep 18, 2024
Fix deepmodeling#3713. Fix deepmodeling#3733. This is a breaking change.

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

- **New Features**
- Introduced a new method `has_message_passing` across various
descriptor classes. This method returns a boolean indicating whether the
descriptor has message passing capability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants