fix(pt): fail early when compress lacks custom ops#5610
Conversation
Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5)
f0ddb9d to
3112b13
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a pre-flight check to ChangesCustomized OP guard for compress entrypoint
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@source/tests/pt/test_compress_entrypoint.py`:
- Around line 13-27: The current regression tests only cover
assert_customized_op_available_for_compression in isolation, so they do not
protect the actual enable_compression flow. Add a new test in
test_compress_entrypoint.py that patches compress.ENABLE_CUSTOMIZED_OP to False,
calls compress.enable_compression(), and asserts it raises before
torch.jit.load() is reached; use the existing helpers and symbols like
enable_compression() and assert_customized_op_available_for_compression() to
locate the right path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1d5de2ea-a0ca-4700-b402-5b165e09db31
📒 Files selected for processing (2)
deepmd/pt/entrypoints/compress.pysource/tests/pt/test_compress_entrypoint.py
There was a problem hiding this comment.
🧹 Nitpick comments (1)
deepmd/pt/entrypoints/compress.py (1)
64-65: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the
enable_compression()call site in tests.The current regression tests only exercise
assert_customized_op_available_for_compression()directly. If Line 64 is removed later, the suite would still stay green, so the "dp --pt compressfails early" contract is not fully pinned down yet. Please add one entrypoint-level test that assertsenable_compression()raises beforetorch.jit.load()when customized ops are unavailable.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@deepmd/pt/entrypoints/compress.py` around lines 64 - 65, Add an entrypoint-level regression test around enable_compression() in compress.py so the early-failure contract is covered end to end. The current tests only call assert_customized_op_available_for_compression() directly, so they would miss a removed guard in enable_compression(); add a test that exercises enable_compression() itself, verifies it raises when customized ops are unavailable, and confirms the failure happens before any torch.jit.load() call. Use the enable_compression() and assert_customized_op_available_for_compression() symbols to locate the code path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@deepmd/pt/entrypoints/compress.py`:
- Around line 64-65: Add an entrypoint-level regression test around
enable_compression() in compress.py so the early-failure contract is covered end
to end. The current tests only call
assert_customized_op_available_for_compression() directly, so they would miss a
removed guard in enable_compression(); add a test that exercises
enable_compression() itself, verifies it raises when customized ops are
unavailable, and confirms the failure happens before any torch.jit.load() call.
Use the enable_compression() and
assert_customized_op_available_for_compression() symbols to locate the code
path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b426579c-3496-4bde-8f98-5ff3d42bad87
📒 Files selected for processing (2)
deepmd/pt/entrypoints/compress.pysource/tests/pt/test_compress_entrypoint.py
🚧 Files skipped from review as they are similar to previous changes (1)
- source/tests/pt/test_compress_entrypoint.py
Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5610 +/- ##
=======================================
Coverage 82.41% 82.41%
=======================================
Files 903 903
Lines 101846 101850 +4
Branches 4071 4072 +1
=======================================
+ Hits 83940 83944 +4
+ Misses 16439 16437 -2
- Partials 1467 1469 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
dp --pt compresswhenlibdeepmd_op_ptis not loadedAddresses #5368.
Tests
python3 -m py_compile deepmd/pt/entrypoints/compress.py source/tests/pt/test_compress_entrypoint.pyuvx ruff check deepmd/pt/entrypoints/compress.py source/tests/pt/test_compress_entrypoint.pyuvx ruff format --check deepmd/pt/entrypoints/compress.py source/tests/pt/test_compress_entrypoint.pygit diff --checkCould not run the pytest case locally because this checkout does not have the project test dependencies installed, and
uv run --extra test ...failed dependency resolution before creating a usable test environment.Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5)
Summary by CodeRabbit
Bug Fixes
dp --pt compressto confirm the required PyTorch customized operations are loaded before compression starts.Tests