Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function (`train_nep` / `train_nep_sharded`):
| `recompute_q_scaler` | `False` | only with `finetune_from`: recompute the descriptor scaler on the new data instead of keeping the source model's |
| `slim_types` | `False` | drop element types absent from the dataset |
| `energy_key` | `"energy"` | comment-line tag read as reference energy (e.g. `"atomization_energy"`) |
| `use_gpumd_qscaler` | `True` | reproduce GPUMD's init (SNES `mu`): re-init every parameter — descriptor coeffs **and** NN weights — uniform(−1,1), and compute `q_scaler` with coeffs `c=1`. Fresh training only |
| `use_gpumd_qscaler` | `False` | `False`: torch's default init + self-consistent `q_scaler` — converges to better minima (600-epoch 4-seed benchmark: ~12% lower E/V RMSE, ~3% lower F). `True`: reproduce GPUMD's init (SNES `mu`, all parameters uniform(−1,1)) with the `c=1` `q_scaler` — for GPUMD-comparison runs. The saved `nep.txt` is GPUMD-compatible either way. Fresh training only |
| `run_seed` | `None` | master RNG seed. `None` = random each run; an int makes the run reproducible (weight init + batch shuffle). Saved in `checkpoint.pt`, restored on resume |
| `valid_file` | `None` | validation `.xyz`, `nep_best` and the plateau LR schedule follow the validation loss; writes GPUMD-style `*_test.out` |
| `valid_ratio` | `None` | hold out this fraction (e.g. `0.1`) of `data_file` as the validation set; the split is drawn from `run_seed` and preserved on resume. Mutually exclusive with `valid_file` |
Expand Down
6 changes: 6 additions & 0 deletions releaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

- **`use_gpumd_qscaler` now defaults to `False`**: torch's default init
with the self-consistent q_scaler converges to clearly better minima
than the GPUMD-style start (600-epoch 4-seed PdCuNiP benchmark: ~12%
lower E/V RMSE, ~3% lower F, on train and validation alike). `True`
(the old default) remains available for GPUMD-comparison runs; the
saved nep.txt is GPUMD-compatible either way.
- **`export_valid_split`**: write the exact `valid_ratio` split
`train_nep` uses as verbatim GPUMD-ready `train.xyz` / `test.xyz`
files, so the same data partition can be trained in GPUMD and the loss
Expand Down
22 changes: 13 additions & 9 deletions torchnep/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ def train_nep(
recompute_q_scaler: bool = False,
slim_types: bool = False,
energy_key: str = "energy",
use_gpumd_qscaler: bool = True,
use_gpumd_qscaler: bool = False,
run_seed: int = None,
valid_file: str = None,
valid_ratio: float = None,
Expand Down Expand Up @@ -1180,14 +1180,18 @@ def train_nep(
energy_key : name of the comment-line tag read as the reference energy
(default ``"energy"``). Set to ``"atomization_energy"`` to train
against atomization energies instead of totals.
use_gpumd_qscaler : Default True — reproduce GPUMD's initialization: every
parameter is re-initialised uniform(-1, 1) — the descriptor
coefficients AND the NN weights (w0/b0/w1), matching SNES's mu init —
and the q_scaler is computed with all coefficients = 1.0 (GPUMD's
generation-0 ``initial_para``). False leaves torch's default NN init in
place and uses the self-consistent q_scaler (computed from the model's
actual init coefficients). Only applies to fresh training (ignored
under finetune_from).
use_gpumd_qscaler : Default False — torch's default init with the
self-consistent q_scaler (computed from the model's actual init
coefficients). On a 600-epoch 4-seed PdCuNiP benchmark this
converges to clearly better minima than the GPUMD-style start
(~12% lower E/V RMSE, ~3% lower F, train and validation alike).
True reproduces GPUMD's initialization instead: every parameter
re-initialised uniform(-1, 1) (SNES mu init) and the q_scaler
computed with all coefficients = 1.0 (GPUMD's generation-0
``initial_para``) — useful for GPUMD-comparison runs. Either way
the saved nep.txt is fully GPUMD-compatible (the scaler is stored
in the file). Only applies to fresh training (ignored under
finetune_from).
run_seed : master RNG seed for this run. None (default) -> a fresh random
seed each run, so repeated runs differ (independent weight init AND
per-epoch batch shuffle) — the stochastic-testing behaviour. Pass an
Expand Down
2 changes: 1 addition & 1 deletion torchnep/train_sharded.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def train_nep_sharded(
recompute_q_scaler: bool = False,
slim_types: bool = False,
energy_key: str = "energy",
use_gpumd_qscaler: bool = True,
use_gpumd_qscaler: bool = False,
run_seed: int = None,
valid_file: str = None,
valid_ratio: float = None,
Expand Down
Loading