deepmd.pt_expt.entrypoints.main#

Training entrypoint for the pt_expt backend.

Attributes#

Functions#

_detect_lmdb_path(→ str | None)

Return the LMDB path when systems_raw is a scalar LMDB string.

_get_neighbor_stat_data(→ Any)

Return a data proxy suitable for BaseModel.update_sel (neighbor stat).

_build_data_system(...)

Build a data system from dataset config, routing LMDB paths to LmdbDataSystem.

get_trainer(→ deepmd.pt_expt.train.training.Trainer)

Build a training.Trainer from a normalised config.

train(→ None)

Run training with the pt_expt backend.

freeze(→ None)

Freeze a pt_expt checkpoint into a .pte exported model.

change_bias(→ None)

Change the output bias of a pt_expt model.

main(→ None)

Entry point for the pt_expt backend CLI.

Module Contents#

deepmd.pt_expt.entrypoints.main.log[source]#
deepmd.pt_expt.entrypoints.main._detect_lmdb_path(systems_raw: Any) str | None[source]#

Return the LMDB path when systems_raw is a scalar LMDB string.

Returns None for non-LMDB inputs. Raises ValueError if systems_raw is a list containing any LMDB path, so both _get_neighbor_stat_data and _build_data_system fail with the same clear message instead of the opaque error from process_systems() / DeepmdData.

deepmd.pt_expt.entrypoints.main._get_neighbor_stat_data(dataset_params: dict[str, Any], type_map: list[str] | None) Any[source]#

Return a data proxy suitable for BaseModel.update_sel (neighbor stat).

Routes a scalar LMDB systems path through dpmodel’s make_neighbor_stat_data; falls back to the legacy get_data for npy/HDF5 directories.

deepmd.pt_expt.entrypoints.main._build_data_system(dataset_params: dict[str, Any], type_map: list[str], seed: int | None = None) deepmd.utils.data_system.DeepmdDataSystem | deepmd.pt_expt.utils.lmdb_dataset.LmdbDataSystem[source]#

Build a data system from dataset config, routing LMDB paths to LmdbDataSystem.

A scalar systems value pointing at an LMDB directory triggers the LMDB adapter; otherwise we fall through to the legacy DeepmdDataSystem path with system expansion.

deepmd.pt_expt.entrypoints.main.get_trainer(config: dict[str, Any], init_model: str | None = None, restart_model: str | None = None, finetune_model: str | None = None, finetune_links: dict | None = None, shared_links: dict | None = None) deepmd.pt_expt.train.training.Trainer[source]#

Build a training.Trainer from a normalised config.

deepmd.pt_expt.entrypoints.main.train(input_file: str, init_model: str | None = None, restart: str | None = None, finetune: str | None = None, model_branch: str = '', use_pretrain_script: bool = False, skip_neighbor_stat: bool = False, output: str = 'out.json') None[source]#

Run training with the pt_expt backend.

Parameters:
input_filestr

Path to the JSON configuration file.

init_modelstr or None

Path to a checkpoint to initialise weights from.

restartstr or None

Path to a checkpoint to restart training from.

finetunestr or None

Path to a pretrained checkpoint to fine-tune from.

model_branchstr

Branch to select from a multi-task pretrained model.

use_pretrain_scriptbool

If True, copy descriptor/fitting params from the pretrained model.

skip_neighbor_statbool

Skip neighbour statistics calculation.

outputstr

Where to dump the normalised config.

deepmd.pt_expt.entrypoints.main.freeze(model: str, output: str = 'frozen_model.pte', head: str | None = None) None[source]#

Freeze a pt_expt checkpoint into a .pte exported model.

Parameters:
modelstr

Path to the checkpoint file (.pt).

outputstr

Path for the output .pte file.

headstr or None

Head to freeze in multi-task mode.

deepmd.pt_expt.entrypoints.main.change_bias(input_file: str, mode: str = 'change', bias_value: list | None = None, datafile: str | None = None, system: str = '.', numb_batch: int = 0, model_branch: str | None = None, output: str | None = None) None[source]#

Change the output bias of a pt_expt model.

Parameters:
input_filestr

Path to the model file (.pt checkpoint or .pte frozen model).

modestr

"change" or "set".

bias_valuelist or None

User-defined bias values (one per type).

datafilestr or None

File listing data system paths.

systemstr

Data system path (used when datafile is None).

numb_batchint

Number of batches for statistics (0 = all).

model_branchstr or None

Branch name for multi-task models.

outputstr or None

Output file path.

deepmd.pt_expt.entrypoints.main.main(args: list[str] | argparse.Namespace | None = None) None[source]#

Entry point for the pt_expt backend CLI.

Parameters:
argslist[str] | argparse.Namespace | None

Command-line arguments or pre-parsed namespace.