-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR - add data_requirement for dataloader - reformat `make_stat_input` and related training code - support single-task & multi-task training --------- Signed-off-by: Duo <[email protected]> Signed-off-by: Han Wang <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Han Wang <[email protected]>
- Loading branch information
1 parent
54efc03
commit 16c6db6
Showing
42 changed files
with
1,409 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
from deepmd.dpmodel.atomic_model import ( | ||
DPAtomicModel, | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,30 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
from abc import ( | ||
ABC, | ||
abstractmethod, | ||
) | ||
from typing import ( | ||
List, | ||
) | ||
|
||
import torch | ||
|
||
from deepmd.utils.data import ( | ||
DataRequirementItem, | ||
) | ||
|
||
|
||
class TaskLoss(torch.nn.Module): | ||
class TaskLoss(torch.nn.Module, ABC): | ||
def __init__(self, **kwargs): | ||
"""Construct loss.""" | ||
super().__init__() | ||
|
||
def forward(self, model_pred, label, natoms, learning_rate): | ||
"""Return loss .""" | ||
raise NotImplementedError | ||
|
||
@property | ||
@abstractmethod | ||
def label_requirement(self) -> List[DataRequirementItem]: | ||
"""Return data label requirements needed for this loss calculation.""" | ||
pass |
Oops, something went wrong.