Skip to content

support mixed:N batch size #1183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dpgen/generator/arginfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def data_args() -> List[Argument]:
doc_init_data_prefix = "Prefix of initial data directories."
doc_init_data_sys = "Paths of initial data. The path can be either a system diretory containing NumPy files or an HDF5 file. You may use either absolute or relative path here. Systems will be detected recursively in the directories or the HDF5 file."
doc_sys_format = "Format of sys_configs."
doc_init_batch_size = "Each number is the batch_size of corresponding system for training in init_data_sys. One recommended rule for setting the sys_batch_size and init_batch_size is that batch_size mutiply number of atoms ot the stucture should be larger than 32. If set to auto, batch size will be 32 divided by number of atoms."
doc_init_batch_size = "Each number is the batch_size of corresponding system for training in init_data_sys. One recommended rule for setting the sys_batch_size and init_batch_size is that batch_size mutiply number of atoms ot the stucture should be larger than 32. If set to auto, batch size will be 32 divided by number of atoms. This argument will not override the mixed batch size in `default_training_param`."
doc_sys_configs_prefix = "Prefix of sys_configs."
doc_sys_configs = "Containing directories of structures to be explored in iterations.Wildcard characters are supported here."
doc_sys_batch_size = "Each number is the batch_size for training of corresponding system in sys_configs. If set to auto, batch size will be 32 divided by number of atoms."
doc_sys_batch_size = "Each number is the batch_size for training of corresponding system in sys_configs. If set to auto, batch size will be 32 divided by number of atoms. This argument will not override the mixed batch size in `default_training_param`."

return [
Argument("init_data_prefix", str, optional=True, doc=doc_init_data_prefix),
Expand Down
8 changes: 6 additions & 2 deletions dpgen/generator/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,13 @@ def make_train(iter_index, jdata, mdata):
mdata["deepmd_version"]
) < Version("3"):
# 2.x
jinput["training"]["training_data"] = {}
jinput["training"].setdefault("training_data", {})
jinput["training"]["training_data"]["systems"] = init_data_sys
jinput["training"]["training_data"]["batch_size"] = init_batch_size
old_batch_size = jinput["training"]["training_data"].get("batch_size", "")
if not (
isinstance(old_batch_size, str) and old_batch_size.startswith("mixed:")
):
jinput["training"]["training_data"]["batch_size"] = init_batch_size
jinput["model"]["type_map"] = jdata["type_map"]
# electron temperature
if use_ele_temp == 0:
Expand Down