Skip to content

Commit

Permalink
delete useless info
Browse files Browse the repository at this point in the history
  • Loading branch information
Chengqian-Zhang committed May 20, 2024
1 parent 019d361 commit fbe438b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 22 deletions.
1 change: 0 additions & 1 deletion deepmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,6 @@ def main_parser() -> argparse.ArgumentParser:
),
)
parser_list_model_branch.add_argument("INPUT", help="The input multi-task pre-trained model file")

return parser


Expand Down
19 changes: 1 addition & 18 deletions deepmd/pt/entrypoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
from deepmd.pt.train import (
training,
)
from deepmd.pt.utils import (
env,
)
from deepmd.pt.utils.dataloader import (
DpLoaderSet,
)
Expand Down Expand Up @@ -313,21 +310,7 @@ def main(args: Optional[Union[List[str], argparse.Namespace]] = None):
log.info("DeepMD version: %s", __version__)

if FLAGS.command == "train":
if FLAGS.list_model_branch:
assert (
FLAGS.finetune is not None
), "Error: The '--list-model-branch' option requires the '--finetune' argument to specify the model."
state_dict = torch.load(FLAGS.finetune, map_location=env.DEVICE)
if "model" in state_dict:
state_dict = state_dict["model"]
model_params = state_dict["_extra_state"]["model_params"]
finetune_from_multi_task = "model_dict" in model_params
# Pretrained model must be multitask mode
assert finetune_from_multi_task, "Error: The '--list-model-branch' option requires a multitask pretrained model. The provided model does not meet this criterion."
model_branch = list(model_params["model_dict"].keys())
log.info(f"Available model branches are {model_branch}")
else:
train(FLAGS)
train(FLAGS)
elif FLAGS.command == "freeze":
if Path(FLAGS.checkpoint_folder).is_dir():
checkpoint_path = Path(FLAGS.checkpoint_folder)
Expand Down
2 changes: 0 additions & 2 deletions deepmd/pt/train/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
)

log = logging.getLogger(__name__)
from IPython import embed


class Trainer:
Expand Down Expand Up @@ -519,7 +518,6 @@ def update_single_finetune_params(
for i in _random_state_dict.keys()
if i != "_extra_state" and f".{_model_key}." in i
]
embed()
for item_key in target_keys:
if _new_fitting and ".fitting_net." in item_key:
# print(f'Keep {item_key} in old model!')
Expand Down
2 changes: 1 addition & 1 deletion doc/train/finetuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ $ dp --pt train input.json --finetune multitask_pretrained.pt --model-branch CHO
One can check the available model branches in multi-task pre-trained model by refering to the documentation of the pre-trained model or by using the following command:

```bash
$ dp --pt train input.json --finetune multitask_pretrained.pt --list-model-branch
$ dp --pt list-model-branch multitask_pretrained.pt
```

:::
Expand Down

0 comments on commit fbe438b

Please sign in to comment.