Skip to content

fix(tf2): reject unsupported custom neighbor lists#5858

Open
njzjz-bot wants to merge 1 commit into
deepmodeling:masterfrom
njzjz-bot:fix/tf2-deepeval-neighbor-list-5667
Open

fix(tf2): reject unsupported custom neighbor lists#5858
njzjz-bot wants to merge 1 commit into
deepmodeling:masterfrom
njzjz-bot:fix/tf2-deepeval-neighbor-list-5667

Conversation

@njzjz-bot

@njzjz-bot njzjz-bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Closes #5667.

Summary

  • reject custom ASE neighbor lists in the TF2 SavedModel inference constructor
  • explain that SavedModel lower calls accept tensors and require a dedicated ASE-to-extended-tensors adapter plus output fold-back
  • add a focused regression test proving rejection happens before model loading

Why existing tests missed this

  • TestDeepPotNeighborList exercises the TensorFlow 1 .pb inference path, not TF2 SavedModel inference.
  • TF2 consistency tests use the SavedModel native neighbor construction path and never pass the constructor ASE API.
  • live TF2 model tests use the internal tensor-compatible NeighborList, which is distinct from the inference constructor ASE object.
  • TF2 test collection is conditional, further reducing coverage of this backend-specific constructor path.

Validation

  • pytest source/tests/tf2/test_deep_eval.py::test_custom_neighbor_list_is_rejected_before_model_loading -v
  • ruff format .
  • ruff check .
  • git diff --check

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

Summary by CodeRabbit

  • Bug Fixes
    • TensorFlow 2 SavedModel inference now clearly rejects unsupported custom neighbor-list configurations.
    • The error message explains that the model’s built-in neighbor-list builder must be used.

Fail fast when TF2 SavedModel inference receives a custom neighbor_list. The
exported tensor signatures cannot carry an ASE Python object, so accepting it
would silently fall back to native neighbor construction.

Coding-Agent: Codex
Codex-Version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning-Effort: xhigh
@dosubot dosubot Bot added the bug label Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2b227a80-b49d-4dac-a145-8a75ab5cdfe7

📥 Commits

Reviewing files that changed from the base of the PR and between 6c3b985 and ccb21ee.

📒 Files selected for processing (2)
  • deepmd/tf2/infer/deep_eval.py
  • source/tests/tf2/test_deep_eval.py

📝 Walkthrough

Walkthrough

DeepEval now rejects custom neighbor lists for TensorFlow 2 SavedModel inference with NotImplementedError. A regression test verifies the rejection and error message before model loading.

Changes

TF2 neighbor list validation

Layer / File(s) Summary
Reject unsupported custom neighbor lists
deepmd/tf2/infer/deep_eval.py, source/tests/tf2/test_deep_eval.py
DeepEval raises NotImplementedError when neighbor_list is provided, and the new test verifies the exception and "custom ASE neighbor_list" message pattern.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: rejecting unsupported custom TF2 neighbor lists.
Linked Issues check ✅ Passed The PR rejects non-None TF2 DeepEval neighbor_list values and adds regression coverage, satisfying issue #5667.
Out of Scope Changes check ✅ Passed The changes stay focused on TF2 DeepEval neighbor-list handling and the corresponding regression test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.90%. Comparing base (6c3b985) to head (ccb21ee).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5858      +/-   ##
==========================================
- Coverage   78.58%   76.90%   -1.69%     
==========================================
  Files        1050     1050              
  Lines      120637   120614      -23     
  Branches     4356     4349       -7     
==========================================
- Hits        94801    92753    -2048     
- Misses      24278    26507    +2229     
+ Partials     1558     1354     -204     

☔ View full report in Codecov by Harness.
📢 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.

@njzjz

njzjz commented Jul 18, 2026

Copy link
Copy Markdown
Member

Possible reviewers based on changed lines, exact file history, and exact-file review history:

  • @wanghan-iapcm — 1 commits on changed files (deepmd/tf2/infer/deep_eval.py).

No review request was made automatically.

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

@njzjz
njzjz requested a review from wanghan-iapcm July 18, 2026 07:26
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.

[Code scan] Do not silently ignore TF2 DeepEval neighbor_list

2 participants