Skip to content

Conversation

@caic99
Copy link
Member

@caic99 caic99 commented Aug 26, 2025

Avoid specifying pin_memory for test DataLoaders to eliminate warnings when no accelerator is available.
#4874

Summary by CodeRabbit

  • Tests
    • Updated test configurations to rely on default memory pinning behavior in data loading, improving compatibility across environments.
    • Simplified test setup parameters to reduce potential flakiness and align with framework defaults.

@caic99 caic99 requested review from Copilot and njzjz August 26, 2025 05:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the pin_memory=True parameter from PyTorch DataLoader configurations in test files to eliminate warnings when no GPU accelerator is available during testing.

  • Removes pin_memory=True from three test files to prevent unnecessary warnings
  • Maintains all other DataLoader configuration parameters unchanged
  • Improves test execution by avoiding GPU-related warnings in CPU-only environments

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
source/tests/pt/test_sampler.py Removes pin_memory parameter from DataLoader in sampler test
source/tests/pt/model/test_saveload_se_e2_a.py Removes pin_memory parameter from DataLoader in SE_e2_a model test
source/tests/pt/model/test_saveload_dpa1.py Removes pin_memory parameter from DataLoader in DPA1 model test

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

📝 Walkthrough

Walkthrough

Removed explicit pin_memory=True from PyTorch DataLoader constructions in three test files, reverting to default pin_memory behavior. No other parameters or test logic changed. No public API changes.

Changes

Cohort / File(s) Summary of changes
Model save/load tests — remove pin_memory from DataLoader
source/tests/pt/model/test_saveload_dpa1.py, source/tests/pt/model/test_saveload_se_e2_a.py
Dropped pin_memory=True in setUp DataLoader initializations; rely on default pin_memory. Other args unchanged.
Sampler test — remove pin_memory from DataLoader
source/tests/pt/test_sampler.py
Removed pin_memory=True in test_sampler_debug_info DataLoader; rely on default. Other args unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

Python

Suggested reviewers

  • njzjz

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3f0087b and a21516b.

📒 Files selected for processing (3)
  • source/tests/pt/model/test_saveload_dpa1.py (0 hunks)
  • source/tests/pt/model/test_saveload_se_e2_a.py (0 hunks)
  • source/tests/pt/test_sampler.py (0 hunks)
💤 Files with no reviewable changes (3)
  • source/tests/pt/model/test_saveload_dpa1.py
  • source/tests/pt/model/test_saveload_se_e2_a.py
  • source/tests/pt/test_sampler.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). (29)
  • GitHub Check: Test C++ (false)
  • GitHub Check: Test C++ (true)
  • 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 wheels for cp310-manylinux_aarch64
  • GitHub Check: Build wheels for cp311-win_amd64
  • GitHub Check: Build wheels for cp311-macosx_arm64
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (5, 3.12)
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Test Python (6, 3.12)
  • GitHub Check: Build wheels for cp311-macosx_x86_64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Build C++ (rocm, rocm)
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Build C++ (cuda, cuda)
  • GitHub Check: Build C++ (cpu, cpu)
  • GitHub Check: Build C++ (cuda120, cuda)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (c-cpp)
✨ 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.
    • 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.
  • 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 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/Issue comments)

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

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@njzjz njzjz enabled auto-merge August 26, 2025 06:40
@codecov
Copy link

codecov bot commented Aug 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.29%. Comparing base (3f0087b) to head (a21516b).
⚠️ Report is 67 commits behind head on devel.

Additional details and impacted files
@@           Coverage Diff           @@
##            devel    #4919   +/-   ##
=======================================
  Coverage   84.29%   84.29%           
=======================================
  Files         703      703           
  Lines       68728    68727    -1     
  Branches     3572     3572           
=======================================
+ Hits        57934    57935    +1     
+ Misses       9653     9652    -1     
+ Partials     1141     1140    -1     

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

@njzjz njzjz added this pull request to the merge queue Aug 26, 2025
Merged via the queue into deepmodeling:devel with commit 630f233 Aug 26, 2025
60 checks passed
ChiahsinChu pushed a commit to ChiahsinChu/deepmd-kit that referenced this pull request Dec 17, 2025
Avoid specifying pin_memory for test DataLoaders to eliminate warnings
when no accelerator is available.
deepmodeling#4874

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Tests**
* Updated test configurations to rely on default memory pinning behavior
in data loading, improving compatibility across environments.
* Simplified test setup parameters to reduce potential flakiness and
align with framework defaults.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants