Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: move init_models to setUpModule #3715

Merged
merged 5 commits into from
May 6, 2024

Conversation

njzjz
Copy link
Member

@njzjz njzjz commented Apr 27, 2024

Summary by CodeRabbit

  • Refactor
    • Enhanced the initialization process of global variables across multiple test modules to improve test setup efficiency and consistency.

so that the setup timing will be shown correctly

Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Copy link
Contributor

coderabbitai bot commented Apr 27, 2024

Walkthrough

Walkthrough

The recent modifications across various test files primarily involve restructuring the initialization of global variables. This has been standardized by moving these initializations into the setUpModule function across multiple test modules. This change ensures that the variables are accessible globally within each module, enhancing the setup process and consistency of test environments.

Changes

File Path Change Summary
source/tests/pt/test_multitask.py Moved multitask_template initialization to setUpModule as a global variable.
source/tests/tf/test_model_compression_se_a.py Restructured global variables initialization in setUpModule.
source/tests/tf/test_model_compression_se_a_ebd.py Moved multiple global variables' initialization to setUpModule.
source/tests/tf/test_model_compression_se_a_ebd_type_one_side.py Initialization of INPUT, FROZEN_MODEL, COMPRESSED_MODEL moved to setUpModule.
source/tests/tf/test_model_compression_se_atten.py Updated global variables' initialization within setUpModule.
source/tests/tf/test_model_compression_se_r.py Global variables moved to setUpModule scope.
source/tests/tf/test_model_compression_se_t.py Global variables INPUT, FROZEN_MODEL, COMPRESSED_MODEL initialized in setUpModule.
deepmd/tf/common.py Introduced Version import from packaging.version for TensorFlow version check and graph rewrite.
source/tests/tf/test_mixed_prec_training.py Added clear_session import and method call in tearDown from deepmd.tf.common.

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 79caa81 and e4e07ce.
Files selected for processing (2)
  • deepmd/tf/common.py (3 hunks)
  • source/tests/tf/test_mixed_prec_training.py (2 hunks)
Additional comments not posted (2)
source/tests/tf/test_mixed_prec_training.py (1)

67-67: Ensure compatibility of clear_session with the TensorFlow version used.

Verification successful

The compatibility of the clear_session method with the TensorFlow version used in the codebase has been verified. The codebase uses TensorFlow version 1.14.0 or newer, which supports the clear_session method. Therefore, the use of clear_session in the tearDown method is appropriate and compatible.

  • TensorFlow version in use: 1.14.0 or newer
  • Compatibility with clear_session: Confirmed
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify TensorFlow version compatibility with `clear_session`.

# Test: Check TensorFlow version. Expect: Version should support `clear_session`.
rg --type py 'TF_VERSION' source/tests/tf/test_mixed_prec_training.py

Length of output: 251

deepmd/tf/common.py (1)

296-300: Verify the accuracy of TensorFlow version conditions for mixed precision settings.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

Copy link

codecov bot commented Apr 27, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 72.07%. Comparing base (2be5f0f) to head (e4e07ce).

Files Patch % Lines
deepmd/tf/common.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##            devel    #3715       +/-   ##
===========================================
- Coverage   82.19%   72.07%   -10.12%     
===========================================
  Files         513      513               
  Lines       47642    47639        -3     
  Branches     2979     2980        +1     
===========================================
- Hits        39159    34336     -4823     
- Misses       7572    12481     +4909     
+ Partials      911      822       -89     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue Apr 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 29, 2024
@njzjz njzjz added this pull request to the merge queue Apr 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 29, 2024
github-merge-queue bot pushed a commit that referenced this pull request Apr 29, 2024
Split each pytest job into 6 separated jobs in GHA.

Currently, each separated job takes:
- ~2.5 min for installation, which may need to be optimized in the
future;
- ~2 min for setup, which may be a defect and should be resolved in
#3715;
-  4~5 min for tests (expected).

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
@njzjz njzjz added this pull request to the merge queue Apr 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 29, 2024
@njzjz njzjz added this pull request to the merge queue Apr 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 30, 2024
@njzjz njzjz added this pull request to the merge queue Apr 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 30, 2024
@njzjz
Copy link
Member Author

njzjz commented Apr 30, 2024

It looks to me like something went wrong in source/tests/tf/test_model_compression_se_atten.py.

@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue May 2, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 2, 2024
@njzjz njzjz added the Test CUDA Trigger test CUDA workflow label May 6, 2024
@github-actions github-actions bot removed the Test CUDA Trigger test CUDA workflow label May 6, 2024
@njzjz njzjz added the Test CUDA Trigger test CUDA workflow label May 6, 2024
@njzjz njzjz enabled auto-merge May 6, 2024 08:21
@github-actions github-actions bot removed the Test CUDA Trigger test CUDA workflow label May 6, 2024
@njzjz njzjz added this pull request to the merge queue May 6, 2024
Merged via the queue into deepmodeling:devel with commit 4b319a0 May 6, 2024
63 checks passed
@njzjz njzjz deleted the tests-mv-init-models branch May 6, 2024 10:10
mtaillefumier pushed a commit to mtaillefumier/deepmd-kit that referenced this pull request Sep 18, 2024
)

Split each pytest job into 6 separated jobs in GHA.

Currently, each separated job takes:
- ~2.5 min for installation, which may need to be optimized in the
future;
- ~2 min for setup, which may be a defect and should be resolved in
deepmodeling#3715;
-  4~5 min for tests (expected).

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
mtaillefumier pushed a commit to mtaillefumier/deepmd-kit that referenced this pull request Sep 18, 2024
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Enhanced the initialization process of global variables across
multiple test modules to improve test setup efficiency and consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
Co-authored-by: Han Wang <[email protected]>
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