deepmd.tf.train.trainer#
Attributes#
Classes#
Generate an OP that loads the training data from the given DeepmdDataSystem. |
Functions#
|
Module Contents#
- class deepmd.tf.train.trainer.DPTrainer(jdata: dict, run_opt: Any, is_compress: bool = False)[source]#
-
- build(data: deepmd.tf.utils.data_system.DeepmdDataSystem | None = None, stop_batch: int = 0, origin_type_map: list[str] | None = None, suffix: str = '') None[source]#
- _build_loss() tuple[None, None] | tuple[deepmd.tf.env.tf.Tensor, dict[str, deepmd.tf.env.tf.Tensor]][source]#
- _build_network(data: deepmd.tf.utils.data_system.DeepmdDataSystem, suffix: str = '') None[source]#
- valid_on_the_fly(fp: TextIO, train_batches: list, valid_batches: list, print_header: bool = False, fitting_key: str | None = None) None[source]#
- static print_on_training(fp: TextIO, train_results: dict, valid_results: dict | None, cur_batch: int, cur_lr: float) None[source]#
- static eval_single_list(single_batch_list: list | None, loss: deepmd.tf.loss.loss.Loss, sess: deepmd.tf.env.tf.Session, get_feed_dict_func: collections.abc.Callable, prefix: str = '') dict | None[source]#
- _init_from_pretrained_model(data: deepmd.tf.utils.data_system.DeepmdDataSystem, origin_type_map: list[str] | None = None, bias_adjust_mode: str = 'change-by-statistic') None[source]#
Init the embedding net variables with the given frozen model.
- Parameters:
- data
DeepmdDataSystem The training data.
- origin_type_map
list The original type_map in dataset, they are targets to change the energy bias.
- bias_adjust_mode
str The mode for changing energy bias : [‘change-by-statistic’, ‘set-by-statistic’] ‘change-by-statistic’ : perform predictions on energies of target dataset,
and do least square on the errors to obtain the target shift as bias.
‘set-by-statistic’ : directly use the statistic energy bias in the target dataset.
- data
- _change_energy_bias(data: deepmd.tf.utils.data_system.DeepmdDataSystem, frozen_model: str, origin_type_map: list[str] | None, bias_adjust_mode: str = 'change-by-statistic') None[source]#
- property data_requirements: list[deepmd.utils.data.DataRequirementItem][source]#
- class deepmd.tf.train.trainer.DatasetLoader(train_data: deepmd.tf.utils.data_system.DeepmdDataSystem)[source]#
Generate an OP that loads the training data from the given DeepmdDataSystem.
It can be used to load the training data in the training process, so there is no waiting time between training steps.
- Parameters:
- train_data
DeepmdDataSystem The training data.
- train_data
Examples
>>> loader = DatasetLoader(train_data) >>> data_op = loader.build() >>> with tf.Session() as sess: >>> data_list = sess.run(data_op) >>> data_dict = loader.get_data_dict(data_list)
- get_data_dict(batch_list: list[numpy.ndarray]) dict[str, numpy.ndarray][source]#
Generate a dict of the loaded data.
- Parameters:
- batch_list
list[np.ndarray] The loaded data.
- batch_list
- Returns:
dict[str,np.ndarray]The dict of the loaded data.