Skip to content

Conversation

@OutisLi
Copy link
Contributor

@OutisLi OutisLi commented Jul 31, 2025

When enable_profiler has been set to true, it will save the profiling results into json format in the tensorboard_log_dir. Currently, when both enable_profiler and profiling are set to true, it will throw an error RuntimeError: Trace is already saved. As a result, just ignore the profiling option when enable_profiler is true.

Summary by CodeRabbit

  • Bug Fixes
    • Refined profiling trace export logic to prevent duplicate or unintended trace exports when the new profiler is enabled. Profiling traces are now only exported if profiling is enabled and the new profiler is not active.
  • Documentation
    • Updated profiling documentation to clarify that when the new profiler is enabled, profiling results are saved to TensorBoard logs instead of a Chrome JSON file.

@OutisLi OutisLi changed the base branch from master to devel July 31, 2025 08:43
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

📝 Walkthrough

Walkthrough

The update refines the logic for exporting a profiling trace at the end of training in the Trainer class. Now, the trace is exported only if profiling is enabled and the new enable_profiler flag is not set, updating the previous unconditional export when profiling was enabled. Additionally, the documentation for the profiling argument in the training_args function was clarified to specify that when enable_profiler is True, the profiling option is ignored and profiling results are saved to the TensorBoard log instead.

Changes

Cohort / File(s) Change Summary
Profiling Trace Export Logic
deepmd/pt/train/training.py
Adjusted the condition for exporting the profiling trace to consider both profiling and enable_profiler flags.
Profiling Argument Documentation
deepmd/utils/argcheck.py
Updated docstring for the profiling argument in training_args to clarify behavior when enable_profiler is True.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • iProzd
  • wanghan-iapcm

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2eb1117 and 92496f4.

📒 Files selected for processing (1)
  • deepmd/utils/argcheck.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • deepmd/utils/argcheck.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (30)
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Test Python (5, 3.12)
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (6, 3.12)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
  • GitHub Check: Build C library (2.14, >=2.5.0,<2.15, libdeepmd_c_cu11.tar.gz)
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Build C++ (cuda120, cuda)
  • GitHub Check: Build C++ (rocm, rocm)
  • GitHub Check: Build C++ (cpu, cpu)
  • GitHub Check: Build C++ (cuda, cuda)
  • GitHub Check: Build wheels for cp311-macosx_arm64
  • GitHub Check: Build wheels for cp311-win_amd64
  • GitHub Check: Build wheels for cp311-macosx_x86_64
  • GitHub Check: Build wheels for cp310-manylinux_aarch64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Test C++ (false)
  • GitHub Check: Test C++ (true)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Analyze (javascript-typescript)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented Jul 31, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.34%. Comparing base (91ebe34) to head (92496f4).
⚠️ Report is 74 commits behind head on devel.

Files with missing lines Patch % Lines
deepmd/pt/train/training.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            devel    #4855   +/-   ##
=======================================
  Coverage   84.34%   84.34%           
=======================================
  Files         702      702           
  Lines       68585    68585           
  Branches     3573     3572    -1     
=======================================
  Hits        57849    57849           
  Misses       9597     9597           
  Partials     1139     1139           

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

Co-authored-by: Jinzhe Zeng <njzjz@qq.com>
Signed-off-by: LI TIANCHENG <137472077+OutisLi@users.noreply.github.com>
@njzjz njzjz enabled auto-merge August 1, 2025 13:31
@njzjz
Copy link
Member

njzjz commented Aug 6, 2025

@OutisLi please resolve conflicts.

Signed-off-by: LI TIANCHENG <137472077+OutisLi@users.noreply.github.com>
auto-merge was automatically disabled August 10, 2025 08:12

Head branch was pushed to by a user without write access

@njzjz njzjz added this pull request to the merge queue Aug 10, 2025
Merged via the queue into deepmodeling:devel with commit 46411c1 Aug 10, 2025
60 checks passed
@OutisLi OutisLi deleted the profile_bugfix branch September 17, 2025 08:09
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.

4 participants