Skip to content

[BUG] DPA4C compression crashes for trainable=False descriptors #5990

Description

@njzjz-bot

Summary

DescrptDPA4C.enable_compression() crashes when the descriptor was constructed with the supported trainable=False option.

This reproduces on origin/master at 8cfd46e37448.

Reproduction

from deepmd.pt_expt.descriptor.dpa4c import DescrptDPA4C

d = DescrptDPA4C(
    rcut=3.0,
    ntypes=2,
    channels=8,
    lmax=2,
    n_radial=4,
    precision="float32",
    trainable=False,
).eval()
d.enable_compression(0.5, table_stride_1=0.2)

Actual result:

deepmd/kernels/cuda/dpa4c/graph_compress.py:525
sample_parameter = next(descriptor.radial_embedding.parameters())
StopIteration

Cause

build_radial_table() obtains the device and dtype from the first radial-embedding parameter. With trainable=False, the frozen radial MLP weights are registered as buffers, so radial_embedding.parameters() is empty.

Expected behavior

Compression should work for a frozen descriptor. trainable changes parameter registration, not the learned function or compression eligibility.

The device/dtype should be obtained from a tensor that exists in both trainable and frozen forms, and a regression test should enable compression on a trainable=False DPA4C descriptor.


Coding agent: Codex
Codex version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning effort: xhigh

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions