Repository navigation
fix(build): honor disabled TensorFlow for native interfaces - #6051
Zhang-pchao wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Apply TensorFlow selection and test interface options backend/read_env.py, source/tests/test_build_backend.py, pyproject.toml |
The backend uses the stored TensorFlow setting for C++ interface configuration and TensorFlow setup. The regression test checks interface and TensorFlow setting combinations. The test dependency group adds tomli for Python versions below 3.11 and retains dependency_groups. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Possibly related PRs
- deepmodeling/deepmd-kit#6085: Adds
dependency_groupsto the test optional-dependency group, which this change retains.
Suggested labels: bug
Suggested reviewers: njzjz
Merge Risk: 
Minimal · up to a866c
-
The change honors disabled TensorFlow for native-interface builds while preserving the enabled default. No actionable merge-blocking issue was found.
Pre-merge checks: 
5
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 @coderabbitai help to get the list of available commands.
njzjz-bot
left a comment
There was a problem hiding this comment.
Agent: dot
Reviewed exact head 063b873. No blocking findings in this scoped build-option fix.
Traced the native-interface flags through source/CMakeLists.txt: USE_TF_PYTHON_LIBS=TRUE re-enables ENABLE_TENSORFLOW there, so deriving that flag from the same boolean as TensorFlow discovery removes the contradiction for PyTorch-only builds. The default/unset and explicit-enabled paths preserve the prior flags; i-PI script selection and LAMMPS version forwarding remain unchanged. The nine-case regression checks the Python/i-PI/LAMMPS matrix, asserts disabled TensorFlow is never discovered, and clears the cached environment result before and after each invocation.
Validation: source review of both changed files plus backend discovery and CMake consumers. I could not rerun pytest in this review environment because pytest is not installed; no full native build was performed. This review does not approve or run fork CI.
|
The Python collection failure was a missing test dependency: The nine build-option regressions pass in clean Python 3.10.22 and 3.13.16 environments, with no skips. The repository's pre-commit hooks and Ruff checks pass too. The previous C++ sanitizer crash and LAMMPS exit 143 are still under investigation; this dependency fix does not resolve or suppress them. I am checking those paths against the exact base with matched dependencies. The updated upstream workflows currently require approval. The new-head Read the Docs build 35031571 also fails during installation of |
Summary
When an i-PI or LAMMPS interface is requested, derive USE_TF_PYTHON_LIBS from DP_ENABLE_TENSORFLOW instead of unconditionally enabling it. This keeps a PyTorch-only native-interface build from requesting TensorFlow libraries. The existing default behavior, including the default TensorFlow-enabled setting, is preserved.
Tests
A backend-independent regression exercises 9 combinations: Python/i-PI/LAMMPS interfaces and DP_ENABLE_TENSORFLOW set to 0, 1, or unset. It checks that disabled TensorFlow is not discovered and verifies the resulting CMake flags and dp_ipi entry point.
PYTHONPATH=. python -m pytest -q source/tests/test_build_backend.py: 9 passed.Based on current master (7a9510d). This is an independent build-configuration fix and does not modify model evaluation or introduce new backend dependencies.
Summary by CodeRabbit
tomlifor Python versions below 3.11, while retaining dependency group support.CI follow-up (2026-10-07)
The exact-head Read the Docs build fails while installing
doc/requirements.txt, before Sphinx runs: the selected PyTorch headers require C++20, while the current target baseline selects C++17. The same build-standard mismatch appears on all five related contribution heads (#6051 through #6055). Existing issue #6048 and PR #6049 already address this compatibility problem; this PR leaves that repair in its independent upstream review. The Read the Docs check remains failed until that dependency is resolved and the build is rerun. The exact-head pre-commit.ci check passes; GitHub Actions still require maintainer approval.