[BUG] Charge/spin-conditioned DPA4 breaks ragged multi-frame graph batches
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
Bắt đầu với deepmd/pt_expt/descriptor/dpa4.py, lần theo call_graph(), _run_graph() và _apply_charge_spin_embedding(); so sánh cách xử lý của chúng với DPA4C và frame_id_from_n_node(). Bổ sung coverage ở cấp descriptor và model bằng reproduction ragged, đồng thời so sánh batch ragged với các lời gọi độc lập cho từng frame để xác minh rằng các điều kiện vẫn được căn chỉnh khi số lượng node không bằng nhau.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Charge/spin-conditioned DPA4 assumes every frame in a flat graph batch has the same node count. It crashes for a genuinely ragged batch and can attach frame conditions to the wrong nodes for other unequal-count batches.
NeighborGraph defines a flat node axis with N = sum(n_node), and the public EnergyModel.forward_ragged() accepts arbitrary per-frame n_node together with (nf, 2) charge_spin. This reproduces on origin/master at 8cfd46e37448.
Reproduction
import torch
from deepmd.dpmodel.utils.neighbor_graph import NeighborGraph
from deepmd.pt_expt.descriptor.dpa4 import DescrptDPA4
d = DescrptDPA4(
ntypes=1,
sel=2,
rcut=3.0,
channels=4,
n_radial=2,
lmax=0,
kmax=0,
n_blocks=0,
use_env_seed=False,
random_gamma=False,
add_chg_spin_ebd=True,
precision="float64",
seed=1,
).eval()
graph = NeighborGraph(
n_node=torch.tensor([1, 2], dtype=torch.int64),
edge_index=torch.zeros((2, 2), dtype=torch.int64),
edge_vec=torch.zeros((2, 3), dtype=torch.float64),
edge_mask=torch.zeros((2,), dtype=torch.bool),
)
d.call_graph(
graph,
torch.zeros((3,), dtype=torch.int64),
charge_spin=torch.tensor([[0.0, 1.0], [1.0, 2.0]], dtype=torch.float64),
)
Actual result:
deepmd/dpmodel/descriptor/dpa4.py:1972
RuntimeError: shape '[3, 4]' is invalid for input of size 8
Cause
call_graph() reduces the graph to scalar nf; _run_graph() then passes nloc=n_out_nodes // nf; _apply_charge_spin_embedding() broadcasts every frame condition to that uniform width and reshapes it onto the flat node axis.
For n_node=[1, 2], this creates only two condition rows for three nodes. If the total happens to be divisible by nf, unequal frame counts can instead silently assign conditions to the wrong nodes.
Suggested fix
Gather the per-frame condition with frame_id_from_n_node(graph.n_node, n_total=atype.shape[0]), as DPA4C does, and compare a ragged batch against independent single-frame calls in descriptor- and model-level tests.
Related to the currently unreachable production ragged builders tracked in #5938, but this is a separate consumer correctness failure in the public ragged API.
Coding agent: Codex
Codex version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning effort: xhigh
- Ngôn ngữ chính
- Python
- Star
- 2.1k
- Fork
- 654
- Merge trung bình
- 3 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của deepmodeling/deepmd-kit
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
deepmodeling/deepmd-kit#6038 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deepmodeling/deepmd-kit#5991 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Docs enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
deepmodeling/deepmd-kit#5766 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
deepmodeling/deepmd-kit#5689 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deepmodeling/deepmd-kit#5686 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của deepmodeling/deepmd-kit
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
BasedHardware/omi#20271 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
openai/openai-cookbook#3153 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cvss-severity:high devguard l3montree-cybersecurity/devguard/devguard pkg:golang/github.com/l3montree-dev/devguard risk:low state:open
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
l3montree-dev/devguard#3146 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bug confirmed issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
open-webui/open-webui#31849 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày