[BUG] pt_expt .pt2 of a DPZBL model (nlist lower) rejects inputs without ghost atoms: Expected Ne(s54, s96)
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- backend, machine-learning
Línea de trabajo
Start by running the provided repro.py from the repository root with CUDA_VISIBLE_DEVICES= python repro.py; it freezes a DPZBL model and fails when nall == nloc. Then inspect deepmd.pt_expt.utils.serialization._trace_and_export and _strip_shape_assertions, which the issue identifies as relevant entry points. Done means the exported model accepts inputs without ghost atoms while preserving correct inference; add a regression check for the supplied reproduction.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug summary
A DPZBL model (DPA1 with a pair table) frozen to .pt2 through the pt_expt backend, with the nlist lower, fails at inference whenever the extended system has no ghost atom within the cutoff, so that nall == nloc:
RuntimeError: Expected Ne(s54, s96) to be True but received 6
That is the normal situation for a non-periodic input (a molecule or cluster), and for a periodic cell in which no image lies within the cutoff.
The exported program carries runtime assertions that require nall != nloc. A plain DPA1 model exported the same way carries none of them, and it evaluates the same input correctly. So on current master, the guard comes with the pair-table composition. #5502 reported the same class of guard for DPA4/SeZM.
DeePMD-kit Version
master (668b60cc2)
Backend and its version
PyTorch exportable backend (pt_expt); PyTorch 2.13.0+cu130, Python 3.13; reproduced on CPU
How did you download the software?
Built from source
Input Files, Running Commands, Error Log, etc.
Save the script below as repro.py and run it from the repository root, so that the relative use_srtab path resolves. Use CUDA_VISIBLE_DEVICES= python repro.py:
import numpy as np
from deepmd.infer import DeepPot
from deepmd.pt_expt.model import get_model
from deepmd.pt_expt.utils.serialization import deserialize_to_file
config = {
"type_map": ["O", "H", "B"],
"use_srtab": "source/tests/pt/model/water/data/zbl_tab_potential/H2O_tab_potential.txt",
"smin_alpha": 0.1,
"sw_rmin": 0.2,
"sw_rmax": 4.0,
"descriptor": {
"type": "dpa1",
"rcut_smth": 0.5,
"rcut": 4.0,
"sel": 20,
"neuron": [3, 6],
"axis_neuron": 2,
"attn": 4,
"attn_layer": 2,
"attn_dotr": True,
"attn_mask": False,
"activation_function": "tanh",
"set_davg_zero": True,
"type_one_side": True,
"seed": 1,
},
"fitting_net": {"type": "ener", "neuron": [8], "seed": 1},
}
model = get_model(config).to("cpu").eval()
deserialize_to_file("dpzbl.pt2", {"model": model.serialize()}, lower_kind="nlist")
coord = np.array(
[
[2.5181844868, 1.7816201484, 3.2653708448],
[3.4681844868, 1.7816201484, 3.2653708448],
[2.1069247227, 2.3984421871, 2.5468661677],
[3.9483803343, 3.7817931063, 3.0107818782],
[2.3386765694, 2.7552686174, 4.0262878436],
[3.2453983914, 3.7819603024, 1.6852189190],
]
)
atype = np.array([0, 1, 2, 0, 1, 2])
DeepPot("dpzbl.pt2").eval(coord.reshape(1, -1), None, atype)
The last call fails with:
RuntimeError: Expected Ne(s54, s96) to be True but received 6
Steps to Reproduce
- Run the script above. It freezes a small, randomly initialized DPZBL model and evaluates six atoms without a cell. DeepEval passes them with
nall == nloc == 6. - Each of these controls evaluates without error:
- the same archive with
cell = np.eye(3) * 5.0, where every atom has periodic images within the 4 Å cutoff; - the same model without the pair table (drop
use_srtab,smin_alpha,sw_rminandsw_rmaxfrom the config), on the same six atoms, with and without a cell.
- the same archive with
Further Information, Files, and Links
We listed the aten._assert_scalar nodes of deepmd.pt_expt.utils.serialization._trace_and_export(..., lower_kind="nlist")[0].graph_module. The DPZBL export includes four assertions that the DPA1 export lacks, where s54 is extended_coord.shape[1] (nall), s96 is nlist.shape[1] (nloc) and s77 is an internal size of the program:
s96 <= s77
Ne(s77, s96)
s96 <= s54
Ne(s54, s96)
Our reading, which we have not traced to a source line: these are relations that torch.export records from the trace's sample inputs, which have ghost atoms (nall > nloc), as described in #5502. The DPZBL archive evaluates without error when ghost atoms lie within the cutoff, which is consistent with that reading. _strip_shape_assertions already neutralizes the same kind of guard for spin models; its docstring states that those models are correct when nall == nloc.
- Lenguaje dominante
- Python
- Estrellas
- 2.1k
- Forks
- 663
- Merge medio
- 3 d 11 h
- PR fusionados (30 d)
- 25
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de deepmodeling/deepmd-kit
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
deepmodeling/deepmd-kit#6086 ·
Los mantenedores suelen responder en 3 días
-
Fine-tune descriptor mismatch warning should ignore seedPosiblemente ocupada @SiyuanChenToDo la tomó hace 23 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
deepmodeling/deepmd-kit#6038 · 2 comentarios ·
Los mantenedores suelen responder en 3 días
-
Docs enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
deepmodeling/deepmd-kit#5766 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
branch: master lang: py todo comment type: todo
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
deepmodeling/deepmd-kit#5480 ·
Los mantenedores suelen responder en 3 días
-
branch: master lang: toml todo comment type: todo
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
deepmodeling/deepmd-kit#5462 ·
Los mantenedores suelen responder en 3 días
Todos los issues de deepmodeling/deepmd-kit
Issues similares
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
gke-labs/kube-agents#5671 ·
Los mantenedores suelen responder en 1 día
-
docs(auth): Method B step 4 should tell users to tick "Use this client for an AI-powered agent"Abiertodocumentation next-release v0.9.6
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
khuisman/mcp-gee-sweet#1446 ·
Los mantenedores suelen responder en 1 día
-
In-box secret files written before their chmod: lc-creds, stacks tee, and the workspace tokenAbiertomodel:sonnet runtime:claude security size:S
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
FootprintAI/Containarium#3671 ·
Los mantenedores suelen responder en 1 día
-
HolidayBase: reassigning `language` does not re-initialize translations or re-populate holidaysPosiblemente ocupada @shikhabhadoria la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
vacanza/holidays#4116 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug CLI exec
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día