diff --git a/skills/dpgen-simplify/SKILL.md b/skills/dpgen-simplify/SKILL.md index e5cea1d81..89ad16750 100644 --- a/skills/dpgen-simplify/SKILL.md +++ b/skills/dpgen-simplify/SKILL.md @@ -198,6 +198,7 @@ For each stage `train`, `model_devi`, and `fp`, collect or preserve: - `machine.context_type` - `machine.local_root` - `machine.remote_root` +- `resources.batch_type` (use the same backend as `machine.batch_type`) - `resources.number_node` - `resources.cpu_per_node` - `resources.gpu_per_node` @@ -234,12 +235,11 @@ Key fields usually include: - `numb_models` - `default_training_param` - `fp_style` -- `shuffle_poscar` - `fp_task_max` - `fp_task_min` -- `fp_pp_path` -- `fp_pp_files` - `fp_params` +- backend support fields such as `fp_pp_path` and `fp_pp_files` only when the + selected FP schema requires them - `init_pick_number` - `iter_pick_number` - `model_devi_f_trust_lo` @@ -263,7 +263,7 @@ For each stage, keep the following explicit: - `command` - machine or context configuration -- resources +- resources, including the same `batch_type` used by the machine block - queue or partition if needed - cpu and gpu counts - custom scheduler flags @@ -316,6 +316,8 @@ Always provide: - Keep `type_map` ordering consistent with dataset typing. - If required inputs are missing, stop and ask instead of guessing. - If `fp_style` is `none`, skip FP-specific prompts and keep FP-specific settings disabled or unset. +- The machine schema still requires an `fp` stage and a string command. Use the + no-op command `true` when `fp_style` is `none`. - If data is already labeled and the user does not request new labels, enforce `fp_style = "none"` and do not require active FP runtime fields. - Do not assume outer-shell activation is inherited by stage jobs; for scheduler execution, require explicit `source_list` per stage. - If the user already has working templates, patch them rather than overwriting them blindly. diff --git a/skills/dpgen-simplify/assets/machine.template.json b/skills/dpgen-simplify/assets/machine.template.json index e2ddb386d..261d5ca83 100644 --- a/skills/dpgen-simplify/assets/machine.template.json +++ b/skills/dpgen-simplify/assets/machine.template.json @@ -4,46 +4,49 @@ "train": { "command": "dp", "machine": { - "batch_type": null, - "context_type": null, + "batch_type": "Shell", + "context_type": "LazyLocalContext", "local_root": "./", - "remote_root": null + "remote_root": "./" }, "resources": { - "number_node": null, - "cpu_per_node": null, - "gpu_per_node": null, - "group_size": null + "batch_type": "Shell", + "number_node": 1, + "cpu_per_node": 1, + "gpu_per_node": 0, + "group_size": 1 } }, "model_devi": { "command": "dp", "machine": { - "batch_type": null, - "context_type": null, + "batch_type": "Shell", + "context_type": "LazyLocalContext", "local_root": "./", - "remote_root": null + "remote_root": "./" }, "resources": { - "number_node": null, - "cpu_per_node": null, - "gpu_per_node": null, - "group_size": null + "batch_type": "Shell", + "number_node": 1, + "cpu_per_node": 1, + "gpu_per_node": 0, + "group_size": 1 } }, "fp": { - "command": null, + "command": "true", "machine": { - "batch_type": null, - "context_type": null, + "batch_type": "Shell", + "context_type": "LazyLocalContext", "local_root": "./", - "remote_root": null + "remote_root": "./" }, "resources": { - "number_node": null, - "cpu_per_node": null, - "gpu_per_node": null, - "group_size": null + "batch_type": "Shell", + "number_node": 1, + "cpu_per_node": 1, + "gpu_per_node": 0, + "group_size": 1 } } } diff --git a/skills/dpgen-simplify/assets/machine.template.local-shell.json b/skills/dpgen-simplify/assets/machine.template.local-shell.json index 6da1ca260..261d5ca83 100644 --- a/skills/dpgen-simplify/assets/machine.template.local-shell.json +++ b/skills/dpgen-simplify/assets/machine.template.local-shell.json @@ -10,9 +10,10 @@ "remote_root": "./" }, "resources": { + "batch_type": "Shell", "number_node": 1, - "cpu_per_node": null, - "gpu_per_node": null, + "cpu_per_node": 1, + "gpu_per_node": 0, "group_size": 1 } }, @@ -25,14 +26,15 @@ "remote_root": "./" }, "resources": { + "batch_type": "Shell", "number_node": 1, - "cpu_per_node": null, - "gpu_per_node": null, + "cpu_per_node": 1, + "gpu_per_node": 0, "group_size": 1 } }, "fp": { - "command": null, + "command": "true", "machine": { "batch_type": "Shell", "context_type": "LazyLocalContext", @@ -40,9 +42,10 @@ "remote_root": "./" }, "resources": { + "batch_type": "Shell", "number_node": 1, - "cpu_per_node": null, - "gpu_per_node": null, + "cpu_per_node": 1, + "gpu_per_node": 0, "group_size": 1 } } diff --git a/skills/dpgen-simplify/assets/machine.template.server-local-slurm.json b/skills/dpgen-simplify/assets/machine.template.server-local-slurm.json index 6840701b4..07ebcc945 100644 --- a/skills/dpgen-simplify/assets/machine.template.server-local-slurm.json +++ b/skills/dpgen-simplify/assets/machine.template.server-local-slurm.json @@ -7,13 +7,14 @@ "batch_type": "Slurm", "context_type": "LocalContext", "local_root": "./", - "remote_root": null + "remote_root": "./" }, "resources": { - "number_node": null, - "cpu_per_node": null, - "gpu_per_node": null, - "queue_name": null, + "batch_type": "Slurm", + "number_node": 1, + "cpu_per_node": 1, + "gpu_per_node": 0, + "queue_name": "", "group_size": 1, "custom_flags": [], "source_list": [] @@ -25,31 +26,33 @@ "batch_type": "Slurm", "context_type": "LocalContext", "local_root": "./", - "remote_root": null + "remote_root": "./" }, "resources": { - "number_node": null, - "cpu_per_node": null, - "gpu_per_node": null, - "queue_name": null, + "batch_type": "Slurm", + "number_node": 1, + "cpu_per_node": 1, + "gpu_per_node": 0, + "queue_name": "", "group_size": 1, "custom_flags": [], "source_list": [] } }, "fp": { - "command": null, + "command": "true", "machine": { "batch_type": "Slurm", "context_type": "LocalContext", "local_root": "./", - "remote_root": null + "remote_root": "./" }, "resources": { - "number_node": null, - "cpu_per_node": null, - "gpu_per_node": null, - "queue_name": null, + "batch_type": "Slurm", + "number_node": 1, + "cpu_per_node": 1, + "gpu_per_node": 0, + "queue_name": "", "group_size": 1, "custom_flags": [], "source_list": [] diff --git a/skills/dpgen-simplify/assets/machine.template.ssh-remote-slurm.json b/skills/dpgen-simplify/assets/machine.template.ssh-remote-slurm.json index 70fa45e95..88f0116b7 100644 --- a/skills/dpgen-simplify/assets/machine.template.ssh-remote-slurm.json +++ b/skills/dpgen-simplify/assets/machine.template.ssh-remote-slurm.json @@ -7,19 +7,20 @@ "batch_type": "Slurm", "context_type": "SSHContext", "local_root": "./", - "remote_root": null, + "remote_root": "/path/to/remote/work", "remote_profile": { - "hostname": null, - "username": null, + "hostname": "cluster.example.com", + "username": "REPLACE_ME", "port": 22, - "key_filename": null + "key_filename": "/path/to/private/key" } }, "resources": { - "number_node": null, - "cpu_per_node": null, - "gpu_per_node": null, - "queue_name": null, + "batch_type": "Slurm", + "number_node": 1, + "cpu_per_node": 1, + "gpu_per_node": 0, + "queue_name": "", "group_size": 1, "custom_flags": [], "source_list": [] @@ -31,43 +32,45 @@ "batch_type": "Slurm", "context_type": "SSHContext", "local_root": "./", - "remote_root": null, + "remote_root": "/path/to/remote/work", "remote_profile": { - "hostname": null, - "username": null, + "hostname": "cluster.example.com", + "username": "REPLACE_ME", "port": 22, - "key_filename": null + "key_filename": "/path/to/private/key" } }, "resources": { - "number_node": null, - "cpu_per_node": null, - "gpu_per_node": null, - "queue_name": null, + "batch_type": "Slurm", + "number_node": 1, + "cpu_per_node": 1, + "gpu_per_node": 0, + "queue_name": "", "group_size": 1, "custom_flags": [], "source_list": [] } }, "fp": { - "command": null, + "command": "true", "machine": { "batch_type": "Slurm", "context_type": "SSHContext", "local_root": "./", - "remote_root": null, + "remote_root": "/path/to/remote/work", "remote_profile": { - "hostname": null, - "username": null, + "hostname": "cluster.example.com", + "username": "REPLACE_ME", "port": 22, - "key_filename": null + "key_filename": "/path/to/private/key" } }, "resources": { - "number_node": null, - "cpu_per_node": null, - "gpu_per_node": null, - "queue_name": null, + "batch_type": "Slurm", + "number_node": 1, + "cpu_per_node": 1, + "gpu_per_node": 0, + "queue_name": "", "group_size": 1, "custom_flags": [], "source_list": [] diff --git a/skills/dpgen-simplify/assets/param.example.qm7.from-official-docs.json b/skills/dpgen-simplify/assets/param.example.qm7.from-official-docs.json index 0cd4af48c..71b70e5a2 100644 --- a/skills/dpgen-simplify/assets/param.example.qm7.from-official-docs.json +++ b/skills/dpgen-simplify/assets/param.example.qm7.from-official-docs.json @@ -17,6 +17,7 @@ "pick_data": "/path/to/qm7/deepmd_npy", "init_data_prefix": "", "init_data_sys": [], + "sys_configs": [], "sys_batch_size": [ "auto" ], @@ -87,11 +88,8 @@ } }, "fp_style": "gaussian", - "shuffle_poscar": false, "fp_task_max": 1000, "fp_task_min": 10, - "fp_pp_path": "/path/to/fp/support/files", - "fp_pp_files": [], "fp_params": { "keywords": "mn15/6-31g** force nosymm scf(maxcyc=512)", "nproc": 28, diff --git a/skills/dpgen-simplify/assets/param.template.json b/skills/dpgen-simplify/assets/param.template.json index 642d78fab..f7567908b 100644 --- a/skills/dpgen-simplify/assets/param.template.json +++ b/skills/dpgen-simplify/assets/param.template.json @@ -1,24 +1,22 @@ { - "type_map": null, - "mass_map": null, - "pick_data": null, - "sys_configs": null, + "type_map": [ + "REPLACE_ME" + ], + "mass_map": "auto", + "pick_data": "/path/to/deepmd/data", + "sys_configs": [], "init_data_prefix": "", "init_data_sys": [], "sys_batch_size": [ "auto" ], - "train_backend": null, + "train_backend": "tensorflow", "labeled": true, - "fp_task_max": null, - "fp_task_min": null, - "model_devi_e_trust_lo": null, - "model_devi_e_trust_hi": null, - "init_pick_number": null, - "iter_pick_number": null, - "model_devi_f_trust_lo": null, - "model_devi_f_trust_hi": null, + "init_pick_number": 100, + "iter_pick_number": 100, + "model_devi_f_trust_lo": 0.1, + "model_devi_f_trust_hi": 0.3, "numb_models": 4, "fp_style": "none", - "default_training_param": null + "default_training_param": {} } diff --git a/skills/dpgen-simplify/references/machine-fields.md b/skills/dpgen-simplify/references/machine-fields.md index a2d2b8a28..29d04b62d 100644 --- a/skills/dpgen-simplify/references/machine-fields.md +++ b/skills/dpgen-simplify/references/machine-fields.md @@ -18,21 +18,24 @@ Use one of these profiles based on where `dpgen` is launched: 1. Server-local Slurm (already logged into cluster login node) - - `context_type = "LocalContext"` - - `batch_type = "Slurm"` + - `machine.context_type = "LocalContext"` + - `machine.batch_type = "Slurm"` + - `resources.batch_type = "Slurm"` - template: `assets/machine.template.server-local-slurm.json` 1. Local workstation -> remote Slurm cluster - - `context_type = "SSHContext"` - - `batch_type = "Slurm"` + - `machine.context_type = "SSHContext"` + - `machine.batch_type = "Slurm"` + - `resources.batch_type = "Slurm"` - requires `remote_profile` - template: `assets/machine.template.ssh-remote-slurm.json` 1. Local single-machine shell testing - - `context_type = "LazyLocalContext"` - - `batch_type = "Shell"` + - `machine.context_type = "LazyLocalContext"` + - `machine.batch_type = "Shell"` + - `resources.batch_type = "Shell"` - template: `assets/machine.template.local-shell.json` If your current workflow is "on server, submit Slurm jobs", use profile 1. @@ -84,7 +87,9 @@ Typical concerns: - scheduler settings - backend-specific environment -If `fp_style` is `none`, keep this stage disabled/unset and do not require active FP executable settings. +If `fp_style` is `none`, keep this stage inactive and do not require active FP +executable settings. The machine schema still requires the stage and a string +command, so use the no-op command `true`. ## Practical advice diff --git a/tests/test_check_skill_assets.py b/tests/test_check_skill_assets.py new file mode 100644 index 000000000..1399f5526 --- /dev/null +++ b/tests/test_check_skill_assets.py @@ -0,0 +1,28 @@ +"""Validate bundled skill assets against DP-GEN's public input schemas.""" + +import json +import unittest +from pathlib import Path + +from dpgen.simplify.arginfo import simplify_jdata_arginfo, simplify_mdata_arginfo +from dpgen.util import normalize + + +class TestSimplifySkillAssets(unittest.TestCase): + """Ensure every simplify skill JSON asset remains usable as a template.""" + + assets = Path(__file__).parent.parent / "skills" / "dpgen-simplify" / "assets" + + def test_json_assets_match_simplify_schemas(self): + """Normalize parameter and machine assets with their production schemas.""" + for path in sorted(self.assets.glob("*.json")): + with self.subTest(path=path.name): + with path.open() as file: + data = json.load(file) + + arginfo = ( + simplify_jdata_arginfo() + if path.name.startswith("param.") + else simplify_mdata_arginfo() + ) + normalize(arginfo, data)