Skip to content

feat(pretrained): integrate pretrained downloader into deepmd-kit#226

Closed
njzjz-bot wants to merge 3 commits intonjzjz:develfrom
njzjz-bot:feat/pretrained-integration
Closed

feat(pretrained): integrate pretrained downloader into deepmd-kit#226
njzjz-bot wants to merge 3 commits intonjzjz:develfrom
njzjz-bot:feat/pretrained-integration

Conversation

@njzjz-bot
Copy link
Copy Markdown

Summary

This PR integrates the pretrained-dpa functionality directly into deepmd-kit under deepmd/pretrained, while keeping DeepPot usage unchanged.

✅ What is added

  • New CLI command:
    • dp pretrained download <MODEL>
  • New package folder:
    • deepmd/pretrained/
    • includes: registry.py, download.py, backend.py, entrypoints.py
  • Built-in model registry with current models:
    • DPA-3.2-5M
    • DPA-3.1-3M
  • Multi-source download strategy:
    • probe multiple URLs in parallel (small range request)
    • rank by latency
    • try fastest first, fallback on failure/timeout/checksum mismatch
  • SHA256 verification and atomic .part writes
  • .pretrained backend alias support via deepmd/backend/pretrained.py
    • DeepPot("DPA-3.2-5M.pretrained") style remains valid
    • lazy deep-eval adapter to avoid circular import

✅ Command parser integration

  • Added pretrained subcommand in deepmd/main.py
  • Added dispatch handling in deepmd/entrypoints/main.py

✅ Tests added

  • source/tests/common/test_pretrained_parser.py
  • source/tests/common/test_pretrained_download.py
  • source/tests/common/test_pretrained_backend.py

Notes

  • A small fallback metadata file deepmd/__about__.py is included to avoid import failures in source-tree runs when scm-generated version files are absent.

Validation done locally

  • python3 -m compileall on changed modules ✅
  • python3 -m unittest -q source.tests.common.test_pretrained_parser source.tests.common.test_pretrained_download source.tests.common.test_pretrained_backend
  • ruff check on changed files ✅

Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.3-codex)

- add dp pretrained download <MODEL> CLI command
- move pretrained logic under deepmd/pretrained
- add built-in model registry with multi-source probing and fallback
- register .pretrained backend alias so DeepPot usage stays unchanged
- keep deep-eval adapter lazy to avoid circular imports
- add parser/backend/downloader tests

Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.3-codex)
patch,
)

import deepmd.backend # noqa: F401

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'deepmd' is not used.
The fallback file was only added for local source-tree unittest convenience.\nKeep version behavior aligned with upstream packaging flow (_version.py via build).\n\nAuthored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.3-codex)
@njzjz-bot
Copy link
Copy Markdown
Author

Good catch. deepmd/__about__.py was a temporary local fallback I added only to make source-tree unittest imports work without the scm-generated version file.

I have removed it now to stay aligned with upstream versioning flow.

Update:

  • removed in commit 06c1ff9ad
  • no functional change to pretrained integration

Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.3-codex)

Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.3-codex)
@njzjz-bot
Copy link
Copy Markdown
Author

Superseded by upstream PR deepmodeling#5277.

@njzjz-bot njzjz-bot closed this Mar 1, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 1, 2026

Codecov Report

❌ Patch coverage is 58.26087% with 96 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.48%. Comparing base (f959a53) to head (35f384b).

Files with missing lines Patch % Lines
deepmd/pretrained/download.py 66.12% 42 Missing ⚠️
deepmd/pretrained/backend.py 26.78% 41 Missing ⚠️
deepmd/pretrained/entrypoints.py 45.45% 6 Missing ⚠️
deepmd/backend/pretrained.py 80.76% 5 Missing ⚠️
deepmd/entrypoints/main.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #226      +/-   ##
==========================================
- Coverage   81.57%   81.48%   -0.10%     
==========================================
  Files         750      755       +5     
  Lines       75216    75446     +230     
  Branches     3615     3616       +1     
==========================================
+ Hits        61360    61475     +115     
- Misses      12691    12807     +116     
+ Partials     1165     1164       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants