diff --git a/docs/input.md b/docs/input.md index 6fc03bd1..900c56bf 100644 --- a/docs/input.md +++ b/docs/input.md @@ -52,12 +52,19 @@ This section defines how a model is trained. "numb_models" : 4, "config" : {}, "template_script" : "/path/to/the/template/input.json", + "init_models_paths" : [ + "/path/to/model.000.pb", + "/path/to/model.001.pb", + "/path/to/model.002.pb", + "/path/to/model.003.pb" + ], "_comment" : "all" } ``` The `"type" : "dp"` tell the traning method is {dargs:argument}`"dp" `, i.e. calling [DeePMD-kit](https://github.com/deepmodeling/deepmd-kit) to train DP models. The `"config"` key defines the training configs, see {ref}`the full documentation`. The {dargs:argument}`"template_script" ` provides the template training script in `json` format. +When {dargs:argument}`"init_models_paths" ` supplies one model per committee member and those models were already trained on the initial dataset, DPGEN2 automatically skips the iteration-zero training command. It records the generated training script and a skip message, then passes the supplied models directly to exploration. Training resumes after labeling produces iteration data. Finetuning requested with `"do_finetune": true` is never skipped. ### Exploration diff --git a/dpgen2/entrypoint/args.py b/dpgen2/entrypoint/args.py index df11ff7f..a670e130 100644 --- a/dpgen2/entrypoint/args.py +++ b/dpgen2/entrypoint/args.py @@ -85,7 +85,11 @@ def dp_train_args(): doc_numb_models = "Number of models trained for evaluating the model deviation" doc_config = "Configuration of training" doc_template_script = "File names of the template training script. It can be a `List[str]`, the length of which is the same as `numb_models`. Each template script in the list is used to train a model. Can be a `str`, the models share the same template training script. " - doc_init_models_paths = "the paths to initial models" + doc_init_models_paths = ( + "Paths to initial models. When these models already represent the " + "initial dataset, DPGEN2 reuses them and skips training in iteration " + "zero because no iteration-generated data exists yet." + ) doc_init_models_uri = "The URI of initial models" doc_optional_files = "Optional files for training" diff --git a/tests/op/test_run_dp_train.py b/tests/op/test_run_dp_train.py index 45ba950c..ceae626c 100644 --- a/tests/op/test_run_dp_train.py +++ b/tests/op/test_run_dp_train.py @@ -945,7 +945,8 @@ def test_update_input_dict_v2_empty_list(self): ) self.assertDictEqual(odict, self.expected_odict_v2) - def test_exec_v2_empty_list(self): + @patch("dpgen2.op.run_dp_train.run_command") + def test_exec_v2_empty_list(self, mocked_run): config = self.config.copy() config["init_model_policy"] = "no" @@ -989,6 +990,7 @@ def test_exec_v2_empty_list(self): jdata = json.load(fp) self.assertDictEqual(jdata, self.expected_odict_v2) self.assertEqual(Path(out["model"]).read_text(), "this is init model") + mocked_run.assert_not_called() os.remove(self.init_model)