Skip to content

Commit f673c2e

Browse files
Copilotnjzjz
andcommitted
feat(paddle): Enable ANN rule for 2 additional model files with type annotations
- Enable ANN rule for 2 more files, expanding from 29 to 31 total files: - model/task/ener.py: EnergyFittingNet class with complete type annotations - model/model/dp_model.py: DPModelCommon class with method return types - Added comprehensive type annotations to EnergyFittingNet __init__ method with proper kwargs typing - Added return type annotations to get_fitting_net and get_descriptor methods in DPModelCommon - Updated progress tracking to reflect completion of key model task and model files - Progress: 31 files now have ANN rule fully enabled (3,000% increase from initial 1 file) Co-authored-by: njzjz <[email protected]>
1 parent e120f91 commit f673c2e

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

deepmd/pd/model/model/dp_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ def update_sel(
4747
)
4848
return local_jdata_cpy, min_nbor_dist
4949

50-
def get_fitting_net(self):
50+
def get_fitting_net(self) -> object:
5151
"""Get the fitting network."""
5252
return self.atomic_model.fitting_net
5353

54-
def get_descriptor(self):
54+
def get_descriptor(self) -> object:
5555
"""Get the descriptor."""
5656
return self.atomic_model.descriptor
5757

deepmd/pd/model/task/ener.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def __init__(
4848
mixed_types: bool = True,
4949
seed: Optional[Union[int, list[int]]] = None,
5050
type_map: Optional[list[str]] = None,
51-
**kwargs,
52-
):
51+
**kwargs: object,
52+
) -> None:
5353
super().__init__(
5454
"energy",
5555
ntypes,

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,12 @@ runtime-evaluated-base-classes = ["torch.nn.Module"]
458458
"deepmd/pd/model/atomic_model/energy_atomic_model.py" = ["TID253"] # ✅ Fully typed
459459
"deepmd/pd/cxx_op.py" = ["TID253"] # ✅ Fully typed
460460
"deepmd/pd/model/descriptor/__init__.py" = ["TID253"] # ✅ Fully typed
461+
"deepmd/pd/model/task/ener.py" = ["TID253"] # ✅ Fully typed
462+
"deepmd/pd/model/model/dp_model.py" = ["TID253"] # ✅ Fully typed
461463
# TODO: Complete type hints and remove ANN exclusion for remaining files:
462464
"deepmd/pd/train/**" = ["TID253", "ANN"] # 🚧 Partial progress - training.py still needs work
463465
"deepmd/pd/utils/**" = ["TID253", "ANN"] # 🚧 Partial progress - utils.py partially done
464-
"deepmd/pd/loss/**" = ["TID253", "ANN"] # 🚧 Partial progress - ener.py still needs work
466+
"deepmd/pd/loss/**" = ["TID253", "ANN"] # 🚧 Partial progress - other loss files need work
465467
"deepmd/pd/model/**" = ["TID253", "ANN"] # 🚧 Partial progress - some files completed
466468
"deepmd/pd/infer/**" = ["TID253", "ANN"] # 🚧 Partial progress - inference.py completed
467469
"deepmd/dpmodel/**" = ["ANN"]

0 commit comments

Comments
 (0)