Skip to content

Added DeePMD-kit PyTorch backend integration - #604

Closed
rahulumrao wants to merge 7 commits into
TorchSim:mainfrom
rahulumrao:deepmd_torchsim
Closed

rahulumrao wants to merge 7 commits into
TorchSim:mainfrom
rahulumrao:deepmd_torchsim

Conversation

@rahulumrao

@rahulumrao rahulumrao commented Sep 1, 2026 •

Copy link
Copy Markdown

Summary

  • Feature 1
  • Fix 1

Checklist

Before a pull request can be merged, the following items must be checked:

  • Doc strings have been added in the Google docstring format.
  • Run ruff on your code.
  • Tests have been added for any new functionality or bug fixes.

Comment thread docs/reference/deepmd.rst Resolved
Comment thread pyproject.toml Outdated
# phono3py>=4.0.0: some older 3.x sdists (e.g. 3.2.0) fail to build and break uv resolution.
mattersim = ["mattersim>=1.2.5", "phono3py>=4.0.0"]
metatomic = ["metatomic-torchsim>=0.1.1", "metatomic-ase>=0.1.0", "upet>=0.2.0"]
deepmd = ["deepmd_torchsim>=0.1.1"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure to capture any deps clashes below.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified dependency compatibility, the added deepmd = ["deepmd_torchsim>=0.1.1"] doesn't introduce any conflicts. Because deepmd_torchsim is a thin wrapper that places no direct constraints on deepmd-kit or torch, it won't clash with the other extras.

I intentionally leave deepmd-kit out of the direct dependencies since its PyTorch backend requires specific, torch versions. Offloading those constraints to deepmd_torchsim own deepmd extra keeps torch-sim's dependency tree clean and decoupled.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pin a minimum version that works such that all someone would need to do if importing from top level is install the right option. Otherwise there's no benefit to having the ease of use first party import now we adopted an external model posture

In terms of clashes please check once you've pinned a minimum working set which models deepmd can solve the deps alongside and mark the uv clashes in the pyproject toml. This is also important for UX who use TS for interfacing to many models.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! torch-sim[deepmd] now installs deepmd-kit==3.1.3 with torch==2.10.0. All model extras work with deepmd except fairchem, which has a PyTorch version conflict. Added fairchem to the conflicts list.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have standard testing approach for models and their interfaces. Using that infrastructure is a prerequisite to merging here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewritten on the standard infrastructure and now pushed into GitHub. Test used the DPA-3.1-3M universal model, and passed all 22/22 test locally.

@lil-lon

lil-lon commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@rahulumrao Thanks for your interest in contributing! I'm joining the review late, so apologies if this has already been discussed. As far as I understand, deepmd_torchsim comes from your personal repository. Is that correct?

@CompRhys If so, I think it would be better for maintenance to have this integration upstreamed into deepmd-kit. What do you think?

@CompRhys

CompRhys commented Nov 4, 2026

Copy link
Copy Markdown
Member

I have been sitting on this PR unsure if it made sense to merge as something that might not have longer term support.

My true preference is that we will eventually drop all the 1P wrappers here to reduce maintenance burdens.

I agree that upstreaming into deepmd-kit is a better idea and then if they were to open an equivalent CL backed by long term support from deepmodelling then we might consider that.

@rahulumrao

Copy link
Copy Markdown
Author

Thanks for the review, @CompRhys and @lil-lon. I've opened an issue to discuss long-term support with the DeePMD-kit maintainers: deepmodeling/deepmd-kit#6125

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants