xnn.trfnn.models.base.TransformerPotential#
- class xnn.trfnn.models.base.TransformerPotential(*args, **kwargs)[source]#
Bases:
InteratomicPotentialBase of the transformer potentials: energy standardization and per-element references.
Subclasses call
_init_energy_terms()in their__init__. Models whose constants (coupling coefficients, grid matrices) must stay exact in float64 setexact_float64 = True.- Variables:
energy_shift (energy_scale,) – The per-atom standardization buffers.
atom_ref (torch.nn.Embedding) – Learnable per-element energy reference indexed by
Z, initialized to zero.
- Parameters:
- fast_path = ''#
the module of the model’s fast path (its
AUTO_POLICYandAUTO_POLICY_TRAINING)
- set_use_fast(use_fast)[source]#
Choose between the reference layers and the fused kernels of the fast path.
- Parameters:
use_fast (bool or str) –
"auto"(the default): the fused GPU kernels (see the model’s fast-path module inxnn.trfnn.fast) where they are available and faster for the input (a CUDA device, a graph above the size crossover measured for evaluation,AUTO_POLICY, or for training,AUTO_POLICY_TRAINING);True: wherever they are available;False: always the reference implementation. The kernels are twice differentiable, so force training takes them as well.- Returns:
self.- Return type:
- set_energy_scale_shift(scale, shift)[source]#
Set the per-atom energy standardization from training statistics.
- set_atomic_energies(species, values)[source]#
Initialize the per-element reference energies
atom_ref.- Parameters:
- Raises:
ValueError – If the number of values does not match the number of species.
- Return type:
None