deepmd.pt.model.model.model#

Classes#

BaseModel

Base class for final exported model that will be directly used for inference.

Module Contents#

class deepmd.pt.model.model.model.BaseModel(*args, **kwargs)[source]#

Bases: torch.nn.Module, make_base_model()

Base class for final exported model that will be directly used for inference.

The class defines some abstractmethods that will be directly called by the inference interface. If the final model class inherits some of those methods from other classes, BaseModel should be inherited as the last class to ensure the correct method resolution order.

This class is backend-indepedent.

See also

deepmd.dpmodel.model.base_model.BaseModel

BaseModel class for DPModel backend.

model_def_script = ''[source]#

The model definition script.

abstract compute_or_load_stat(sampled_func, stat_file_path: deepmd.utils.path.DPPath | None = None) NoReturn[source]#

Compute or load the statistics parameters of the model, such as mean and standard deviation of descriptors or the energy bias of the fitting net. When sampled is provided, all the statistics parameters will be calculated (or re-calculated for update), and saved in the stat_file_path`(s). When `sampled is not provided, it will check the existence of `stat_file_path`(s) and load the calculated statistics parameters.

Parameters:
sampled_func

The sampled data frames from different data systems.

stat_file_path

The path to the statistics files.

get_model_def_script() str[source]#

Get the model definition script.

get_min_nbor_dist() float | None[source]#

Get the minimum distance between two atoms.

get_ntypes()[source]#

Returns the number of element types.