Commit e35fc38
Han Wang
fix(pt_expt): compiled training runs the graph lower (eager==compiled); drop force_legacy_descriptor
Retarget _CompiledModel to compile forward_common_lower_graph for graph-eligible
descriptors (dpa1 attn_layer==0), gated by the same mixed_types()+uses_graph_lower()
predicate the eager default-flip uses; se_e2_a/dpa2/dpa3 keep compiling the dense
forward_lower. _trace_and_compile_graph builds a synthetic NeighborGraph with
prime-distinct nf/N/E axes (no make_fx duck-shape merge) and edge_vec as the
autograd leaf; _forward_graph builds the carry-all graph eagerly and unravels flat
(N,*) node outputs to (nf,nloc,*). cpp.simdlen=0 for the graph compile avoids an
inductor CPU scatter-vectorizer crash on the per-frame virial atomic_add.
Also fixes an eager autograd bug in dpa1 call_graph: xp.asarray(type_embedding,
device=dev) DETACHES under torch, so the type-embedding weights never trained in
the graph path (grad None despite a real finite-diff dependency). make_fx traced
through it, so compiled != eager and the optimizer diverged after step 0. Use
type_embedding directly (mirrors the dense path); the tebd net now trains and
eager==compiled to 1e-10 across the varying-natoms trajectory.
Drops the force_legacy_descriptor workaround + uses_graph_lower monkeypatch.1 parent ce2fd12 commit e35fc38
3 files changed
Lines changed: 554 additions & 40 deletions
File tree
- deepmd
- dpmodel/descriptor
- pt_expt/train
- source/tests/pt_expt
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
757 | 757 | | |
758 | 758 | | |
759 | 759 | | |
760 | | - | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
761 | 765 | | |
762 | | - | |
| 766 | + | |
763 | 767 | | |
764 | 768 | | |
765 | 769 | | |
| |||
1523 | 1527 | | |
1524 | 1528 | | |
1525 | 1529 | | |
1526 | | - | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
1527 | 1534 | | |
1528 | 1535 | | |
1529 | 1536 | | |
| |||
0 commit comments