deepmd.tf.train.trainer

Module Contents

Classes

DPTrainer

DatasetLoader

Generate an OP that loads the training data from the given DeepmdDataSystem.

Functions

_is_subdir(path, directory)

Attributes

log

deepmd.tf.train.trainer.log[source]
deepmd.tf.train.trainer._is_subdir(path, directory)[source]
class deepmd.tf.train.trainer.DPTrainer(jdata, run_opt, is_compress=False)[source]
_init_param(jdata)[source]
build(data=None, stop_batch=0, origin_type_map=None, suffix='')[source]
_build_lr()[source]
_build_loss()[source]
_build_network(data, suffix='')[source]
_build_optimizer(fitting_key=None)[source]
_build_training()[source]
_init_session()[source]
train(train_data=None, valid_data=None)[source]
save_checkpoint(cur_batch: int)[source]
get_feed_dict(batch, is_training)[source]
get_global_step()[source]
valid_on_the_fly(fp, train_batches, valid_batches, print_header=False, fitting_key=None)[source]
static print_header(fp, train_results, valid_results, multi_task_mode=False)[source]
static print_on_training(fp, train_results, valid_results, cur_batch, cur_lr, multi_task_mode=False, cur_lr_dict=None)[source]
static eval_single_list(single_batch_list, loss, sess, get_feed_dict_func, prefix='')[source]
get_evaluation_results(batch_list)[source]
save_compressed()[source]

Save the compressed graph.

_get_place_holders(data_dict)[source]
_init_from_frz_model()[source]
_init_from_ckpt(ckpt_meta: str)[source]
_init_from_pretrained_model(data, origin_type_map=None, bias_adjust_mode='change-by-statistic')[source]

Init the embedding net variables with the given frozen model.

Parameters:
dataDeepmdDataSystem

The training data.

origin_type_maplist

The original type_map in dataset, they are targets to change the energy bias.

bias_adjust_modestr

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 sqaure on the errors to obtain the target shift as bias.

‘set-by-statistic’ : directly use the statistic energy bias in the target dataset.

_change_energy_bias(data, frozen_model, origin_type_map, bias_adjust_mode='change-by-statistic')[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_dataDeepmdDataSystem

The training 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)
build() List[deepmd.tf.env.tf.Tensor][source]

Build the OP that loads the training data.

Returns:
List[tf.Tensor]

Tensor of the loaded data.

get_data_dict(batch_list: List[numpy.ndarray]) Dict[str, numpy.ndarray][source]

Generate a dict of the loaded data.

Parameters:
batch_listList[np.ndarray]

The loaded data.

Returns:
Dict[str, np.ndarray]

The dict of the loaded data.