deepmd-kit
deepmd-kit copied to clipboard
Replace string search with API call in freeze function
trafficstars
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 https://github.com/deepmodeling/deepmd-kit/pull/3657 and discussed in the comments: https://github.com/deepmodeling/deepmd-kit/pull/3657#discussion_r1576909697