Skip to content

Commit

Permalink
fix(pt): ensure suffix of --init_model and --restart is .pt (#3980
Browse files Browse the repository at this point in the history
)

... as in the command line help, we say "path prefix of checkpoint
files". This will be compatible with the current DP-GEN code.

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

## Summary by CodeRabbit

- **Bug Fixes**
- Ensured that the `.pt` suffix is automatically appended to
`init_model` and `restart` file paths if not already present.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Jul 16, 2024
1 parent fc089c1 commit 66fe16e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions deepmd/pt/entrypoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ def train(FLAGS):
SummaryPrinter()()
with open(FLAGS.INPUT) as fin:
config = json.load(fin)
# ensure suffix, as in the command line help, we say "path prefix of checkpoint files"
if FLAGS.init_model is not None and not FLAGS.init_model.endswith(".pt"):
FLAGS.init_model += ".pt"
if FLAGS.restart is not None and not FLAGS.restart.endswith(".pt"):
FLAGS.restart += ".pt"

# update multitask config
multi_task = "model_dict" in config["model"]
Expand Down

0 comments on commit 66fe16e

Please sign in to comment.