Skip to content

docs(examples): build and document graph.pb generation in infer_water#5699

Merged
wanghan-iapcm merged 1 commit into
deepmodeling:masterfrom
wanghan-iapcm:fix-infer-water-graph-pb
Jul 1, 2026
Merged

docs(examples): build and document graph.pb generation in infer_water#5699
wanghan-iapcm merged 1 commit into
deepmodeling:masterfrom
wanghan-iapcm:fix-infer-water-graph-pb

Conversation

@wanghan-iapcm

@wanghan-iapcm wanghan-iapcm commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Problem

The examples/infer_water README tells users to run cmake and make, but the resulting inference binaries (infer_water_cc, infer_water_c, infer_water_hpp, infer_water_nlist) load a frozen model graph.pb from the current directory. graph.pb is gitignored and never generated, and the convert_model.c helper that creates it is neither built by CMakeLists.txt nor mentioned in the README. Following the documented steps therefore produces binaries that fail at runtime.

Fix

Add convert_model as a CMake target (it uses only DP_ConvertPbtxtToPb from deepmd/c_api.h, so it links DeePMD::deepmd_c like the other C examples) and document the full sequence in the README: build, run ./convert_model to generate graph.pb from the bundled test model source/tests/infer/deeppot.pbtxt, then run the inference examples. The README makes explicit that make only compiles the executables and does not create the model file, and that convert_model must be run from the example directory (so the relative path to the bundled model resolves) with a TensorFlow-enabled build (since graph.pb is a TensorFlow frozen model).

Test

This is a build/documentation example that is not part of the unit-test suite; a meaningful test would require building the example project against an installed TensorFlow-enabled DeePMD-kit and running the binaries, which is outside the unit scope. The fix is verified by inspection: convert_model.c includes only deepmd/c_api.h, DP_ConvertPbtxtToPb is a real C-API function, and the bundled deeppot.pbtxt fixture exists and resolves relative to the example directory.

Fix #5693

Summary by CodeRabbit

  • New Features

    • Added a new helper build target for converting a model file in the water inference example.
    • Expanded the example documentation with step-by-step build and inference guidance.
  • Documentation

    • Clarified that building the example only compiles executables and does not generate the model file.
    • Added instructions for creating the required graph.pb file and running the available inference binaries.

The infer_water README instructed users to run cmake and make, but the
resulting inference binaries load a frozen model graph.pb that is gitignored
and never generated. The convert_model.c helper that creates it was neither
built by CMakeLists.txt nor mentioned in the README, so following the
documented steps produced binaries that failed at runtime.

Add convert_model as a CMake target and document the full sequence: build,
run ./convert_model to generate graph.pb from the bundled test model, then run
the inference examples. The README makes clear that make only compiles the
executables and that convert_model must be run from the example directory with
a TensorFlow-enabled build.

Fix deepmodeling#5693
@wanghan-iapcm wanghan-iapcm requested a review from njzjz July 1, 2026 05:53
@coderabbitai

coderabbitai Bot commented Jul 1, 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: 924696dc-94fe-43b5-a3bc-170be78489e4

📥 Commits

Reviewing files that changed from the base of the PR and between 0e5c170 and bebc166.

📒 Files selected for processing (2)
  • examples/infer_water/CMakeLists.txt
  • examples/infer_water/README.md

📝 Walkthrough

Walkthrough

The infer_water example's CMakeLists.txt now builds a convert_model executable linked against DeePMD::deepmd_c. The README is updated to document building executables, generating graph.pb via convert_model, TensorFlow-backend requirements, and running the inference binaries.

Changes

convert_model build and documentation

Layer / File(s) Summary
Add convert_model target and usage docs
examples/infer_water/CMakeLists.txt, examples/infer_water/README.md
Adds a new convert_model executable target linked against DeePMD::deepmd_c, and updates the README with steps to build, generate graph.pb via convert_model, note the TensorFlow-backend requirement, and run the infer_water_* binaries.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Related issues: #5693

🚥 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 clearly reflects the main change: adding graph.pb generation support and docs for infer_water.
Linked Issues check ✅ Passed The PR adds the convert_model build target and documents generating graph.pb before running infer_water, matching #5693.
Out of Scope Changes check ✅ Passed The changes stay focused on infer_water model generation and documentation, with no obvious unrelated additions.
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.

@wanghan-iapcm wanghan-iapcm enabled auto-merge July 1, 2026 06:09
@wanghan-iapcm wanghan-iapcm requested review from njzjz and removed request for njzjz July 1, 2026 06:11
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.78%. Comparing base (0e5c170) to head (bebc166).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5699      +/-   ##
==========================================
- Coverage   81.97%   81.78%   -0.19%     
==========================================
  Files         959      959              
  Lines      105748   105747       -1     
  Branches     4102     4105       +3     
==========================================
- Hits        86684    86483     -201     
- Misses      17573    17768     +195     
- Partials     1491     1496       +5     

☔ 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.

@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue Jul 1, 2026
Merged via the queue into deepmodeling:master with commit 42de67e Jul 1, 2026
64 of 71 checks passed
@wanghan-iapcm wanghan-iapcm deleted the fix-infer-water-graph-pb branch July 1, 2026 21:22
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] Document or build graph.pb generation in infer_water

2 participants