Skip to content

Commit

Permalink
Fix: add model_def_script to ZBL (#4423)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced model definition handling for improved encapsulation and
consistency across different model types.

- **Bug Fixes**
- Ensured that model definition scripts are correctly set to a JSON
string representation for all model instances.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
anyangml authored Nov 26, 2024
1 parent e7ad8dc commit f343a3b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deepmd/pt/model/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def get_zbl_model(model_params):
rmax = model_params["sw_rmax"]
atom_exclude_types = model_params.get("atom_exclude_types", [])
pair_exclude_types = model_params.get("pair_exclude_types", [])
return DPZBLModel(
model = DPZBLModel(
dp_model,
pt_model,
rmin,
Expand All @@ -205,6 +205,8 @@ def get_zbl_model(model_params):
atom_exclude_types=atom_exclude_types,
pair_exclude_types=pair_exclude_types,
)
model.model_def_script = json.dumps(model_params)
return model


def _can_be_converted_to_float(value) -> Optional[bool]:
Expand Down

0 comments on commit f343a3b

Please sign in to comment.