Modules¶
Neural network modules and model components.
Core Modules¶
core
¶
SRRep(key_out='e_rep', cutoff_fn='none', rc=5.2, reduce_sum=True)
¶
Bases: Module
GFN1-stype short range repulsion function
Source code in aimnet/modules/core.py
205 206 207 208 209 210 211 212 213 214 215 216 217 | |
MLP(n_in, n_out, hidden=None, activation_fn='torch.nn.GELU', activation_kwargs=None, weight_init_fn='torch.nn.init.xavier_normal_', bias=True, last_linear=True)
¶
Convenience function to build MLP from config
Source code in aimnet/modules/core.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
AIMNet2 Model¶
aimnet2
¶
Base Classes¶
base
¶
AIMNet2Base()
¶
Bases: Module
Base class for AIMNet2 models. Implements pre-processing data: converting to right dtype and device, setting nb mode, calculating masks.
Source code in aimnet/models/base.py
191 192 193 194 | |
metadata
property
¶
Return model metadata if available.
prepare_input(data)
¶
Common operations for input preparation.
Source code in aimnet/models/base.py
210 211 212 213 214 215 216 217 218 219 | |
ModelMetadata
¶
Bases: TypedDict
Metadata returned by load_model().
This TypedDict documents the structure of the metadata dictionary.
load_model(path, device='cpu')
¶
Load model from file, supporting both new and legacy formats.
Automatically detects format: - New format: state dict with embedded YAML config and metadata - Legacy format: JIT-compiled TorchScript model
Parameters¶
path : str Path to the model file (.pt or .jpt). device : str Device to load the model on. Default is "cpu".
Returns¶
model : nn.Module The loaded model with weights. metadata : ModelMetadata Dictionary containing model metadata. See ModelMetadata TypedDict for fields.
Notes¶
For legacy JIT models (format_version=1), needs_coulomb and needs_dispersion
are False because LR modules are already embedded in the TorchScript model.
Source code in aimnet/models/base.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |