Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5b45534
feat(jax): support DPA4 training and graph-native inference
OutisLi Oct 29, 2026
394be62
fix(lmp): look up computes and fixes through the Modify accessors
OutisLi Nov 10, 2026
9d8a452
feat(dpa4): DPA4.5 options and presets for extrapolation-safe dynamics
OutisLi Nov 7, 2026
e2ca8da
feat(dpa4): compact canonical lower for DPA4 and model deviation in e…
OutisLi Nov 10, 2026
b9c913d
feat(dpa4): mixture of experts with merge-aware training for DPA4.5
OutisLi Nov 9, 2026
4858a0e
feat(multi-task): reference spin and preset_out_bias in shared_dict
OutisLi Nov 11, 2026
a6a3578
feat(stat): name the spin moment of the isolated atom in preset_out_bias
OutisLi Nov 12, 2026
2398908
feat(stat): declare the reference condition of the isolated atom
OutisLi Nov 12, 2026
9f0cbf4
feat(dpa4c): measure the neighborhood floor and add the dpa4.5c presets
OutisLi Nov 13, 2026
cd86f74
fix(dpa4c): preserve dynamic shapes in multi-block compiled training
OutisLi Nov 13, 2026
190344e
feat(moe): start an MoE model from one trained without it
OutisLi Nov 13, 2026
66d5a4d
feat(preset): use 16 channels for DPA4C Nano v20261111
OutisLi Nov 25, 2026
302a01b
Revert "feat(preset): use 16 channels for DPA4C Nano v20261111"
OutisLi Nov 25, 2026
d168e6c
fix(lmp): initialize ensemble members in C++14 builds
OutisLi Nov 25, 2026
c20242f
fix(pt): restore shared heads and configuration-derived exclusion masks
OutisLi Nov 25, 2026
c409895
fix(jax): share optimizer update semantics across Flax versions
OutisLi Nov 25, 2026
448594c
test(pt-expt): distinguish fused and reference grid calls
OutisLi Nov 25, 2026
0e936c5
test(jax): exercise the SavedModel evaluator initialization
OutisLi Nov 25, 2026
69b63d8
fix(lmp): validate ensemble types selected by pair_coeff
OutisLi Nov 25, 2026
1a63d94
fix(pt-expt): preserve compact graph input contracts in AOT archives
OutisLi Nov 25, 2026
98c35f0
test: verify DPA4.5 backend and compilation contracts across CI envir…
OutisLi Nov 25, 2026
1524f5a
fix(jax): preserve array state on the legacy Flax training stack
OutisLi Nov 25, 2026
77d135a
perf(triton): tune DPA4.5 Max parity tiles on Blackwell
OutisLi Nov 25, 2026
e02b3cc
fix(jax): widen Muon operands on pre-Ampere CUDA devices
OutisLi Nov 25, 2026
7f57b3e
chore(merge): integrate upstream per-rank task sampling
OutisLi Nov 25, 2026
e63c307
fix(pt-expt): recover destination rows from full canonical CSR offsets
OutisLi Nov 25, 2026
65d7fb1
test(pt-expt): isolate precision state and O3 kernel correctness from…
OutisLi Nov 25, 2026
16ca358
fix(pt-expt): preserve small CPU graphs in AOT inference
OutisLi Nov 25, 2026
95ffd60
test(pt-expt): exercise fused SO2 numerics at the calibrated device r…
OutisLi Nov 25, 2026
2c4bba1
fix(pt): use scalar tails for dynamic CPU inference scatters
OutisLi Nov 25, 2026
e4f58bf
fix(pt-expt): bound dynamic Cartesian graph extents for AOT lowering
OutisLi Nov 25, 2026
1bfe037
fix(lammps): preserve host ownership of Kokkos per-atom energy tallies
OutisLi Nov 25, 2026
6c9b426
fix(pt-expt): preserve the real FFT mesh extent during graph export
OutisLi Nov 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
47 changes: 44 additions & 3 deletions deepmd/dpmodel/array_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ def xp_asarray_nodetach(
"""
if array_api_compat.is_array_api_obj(obj):
if array_api_compat.array_namespace(obj) is xp:
# NNX variables expose the JAX namespace but are not JAX array
# leaves. Materialize their differentiable array value before
# passing it to compiled array operations.
if array_api_compat.is_jax_namespace(
xp
) and not array_api_compat.is_jax_array(obj):
obj = xp.asarray(obj)
if dtype is not None and obj.dtype != dtype:
obj = xp.astype(obj, dtype)
if device is not None and array_api_compat.device(obj) != device:
Expand Down Expand Up @@ -120,6 +127,18 @@ def xp_take_along_axis(arr: Array, indices: Array, axis: int) -> Array:
return xp_swapaxes(out, axis, -1)


def xp_matmul(left: Array, right: Array) -> Array:
"""Multiply matrices using the backend's active precision policy."""
xp = array_api_compat.array_namespace(left, right)
if array_api_compat.is_jax_namespace(xp):
from deepmd.jax.utils.precision import (
matmul,
)

return matmul(left, right)
return xp.matmul(left, right)


def xp_einsum(subscripts: str, *operands: Array) -> Array:
"""Contract *operands* according to the Einstein summation *subscripts*.
Expand Down Expand Up @@ -176,10 +195,12 @@ def xp_einsum(subscripts: str, *operands: Array) -> Array:
return torch.einsum(subscripts, *operands)
if array_api_compat.is_numpy_array(operands[0]):
return np.einsum(subscripts, *operands)
if array_api_compat.is_jax_array(operands[0]):
import jax.numpy as jnp
if array_api_compat.is_jax_namespace(array_api_compat.array_namespace(*operands)):
from deepmd.jax.utils.precision import (
einsum,
)

return jnp.einsum(subscripts, *operands)
return einsum(subscripts, *operands)
return _xp_einsum_fallback(subscripts, *operands)


Expand Down Expand Up @@ -515,6 +536,26 @@ def xp_sigmoid(x: Array) -> Array:
return 1 / (1 + xp.exp(-x))


def xp_softmax(logits: Array) -> Array:
"""Compute the softmax over the last axis.
The logits are shifted by their maximum, so large logits do not overflow.
Parameters
----------
logits : Array
Input array with shape (..., K).
Returns
-------
Array
Weights with shape (..., K), summing to one over the last axis.
"""
xp = array_api_compat.array_namespace(logits)
shifted = xp.exp(logits - xp.max(logits, axis=-1, keepdims=True))
return shifted / xp.sum(shifted, axis=-1, keepdims=True)


def xp_erf(x: Array) -> Array:
"""Compute the error function.
Expand Down
14 changes: 14 additions & 0 deletions deepmd/dpmodel/atomic_model/base_atomic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ def has_default_fparam(self) -> bool:
"""Check if the model has default frame parameters."""
return False

def requires_full_neighbor_list(self) -> bool:
"""Whether evaluation requires every neighbor inside the cutoff."""
return False

def uses_graph_lower(self) -> bool:
"""Returns whether this atomic model supports the NeighborGraph lower.
Expand Down Expand Up @@ -358,6 +362,16 @@ def supports_graph_export(self) -> bool:
"""
return True

def supports_canonical_graph(self) -> bool:
"""Whether the graph lower evaluates the compact canonical graph.
See the descriptor capability of the same name. The compact canonical
graph carries every pair within the cutoff, so a model-level pair
exclusion, which the graph build applies, rules it out; an atomic
model without the capability serves no compact canonical graph.
"""
return False

def get_default_fparam(self) -> list[float] | None:
"""Get the default frame parameters."""
return None
Expand Down
9 changes: 4 additions & 5 deletions deepmd/dpmodel/atomic_model/dipole_atomic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
from deepmd.dpmodel.fitting.dipole_fitting import (
DipoleFitting,
)
from deepmd.utils.preset_out_bias import (
preset_assigns,
)

from .dp_atomic_model import (
DPAtomicModel,
Expand Down Expand Up @@ -50,11 +53,7 @@ def __init__(
"fitting must be an instance of DipoleFitting for DPDipoleAtomicModel"
)
super().__init__(descriptor, fitting, type_map, **kwargs)
if self.preset_out_bias is not None and any(
entry is not None
for entries in self.preset_out_bias.values()
for entry in entries
):
if any(preset_assigns(self.preset_out_bias, key) for key in self.bias_keys):
raise ValueError(
"Dipole models do not apply an output bias and cannot use "
"assigned preset_out_bias values."
Expand Down
Loading
Loading