[Code scan] Freeze Paddle DPA3 parameters with stop_gradient
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- python
- Domain
- machine-learning
Research direction
Start in deepmd/pd/model/descriptor/dpa3.py at the parameter-freezing pass around lines 251-253, then compare the corresponding logic in se_a.py and dpa2.py. Replace the ineffective trainable-state handling with the Paddle pattern shown in the issue, and verify that non-trainable DPA3 descriptor parameters remain frozen during training.
Written by the indexing model from the issue text.
Description
This issue comes from a Codex global scan of deepmodeling/deepmd-kit at commit 73de44b1f94471b2e3bdb6b11f57b34d7bc791bb.
Problem
The Paddle DPA3 descriptor tries to honor trainable=False by setting param.requires_grad = trainable:
Other Paddle descriptors freeze parameters with stop_gradient, which is the Paddle parameter flag used by autograd:
Impact
Users configuring a non-trainable Paddle DPA3 descriptor can still update descriptor parameters during training because the freeze pass writes a PyTorch-style attribute instead of Paddle's stop_gradient flag. DPA3's RepFlow/MLP parameters rely on this outer descriptor freeze pass, so the requested freeze does not take effect.
Suggested fix
Use the same Paddle pattern as the neighboring descriptors:
for param in self.parameters():
param.stop_gradient = not trainable
If Paddle exposes any additional trainable-state APIs in the supported versions, keep this consistent across all Paddle descriptor wrappers.
- Dominant language
- Python
- Stars
- 2k
- Forks
- 651
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 18
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from deepmodeling/deepmd-kit
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
deepmodeling/deepmd-kit#5991 ·
-
Docs enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
deepmodeling/deepmd-kit#5766 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
deepmodeling/deepmd-kit#5689 · 2 comments ·
-
branch: master lang: py todo comment type: todo
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
deepmodeling/deepmd-kit#5480 ·
-
branch: master lang: toml todo comment type: todo
Difficulty 1/5 Under an hour Newbie friendliness 72/100
deepmodeling/deepmd-kit#5462 ·
All issues in deepmodeling/deepmd-kit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100