generated from fastai/nbdev_template
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Implement CI test workflow for experimental module #4330
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
Merged
albertvillanova
merged 3 commits into
huggingface:main
from
albertvillanova:run-ci-tests-experimental
Oct 29, 2025
+73
−1
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: Tests (experimental) | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| # Run only when relevant files are modified | ||
| - "trl/experimental/**" | ||
| - "tests/experimental/**" | ||
|
|
||
| env: | ||
| TQDM_DISABLE: 1 | ||
| PYTORCH_CUDA_ALLOC_CONF: "expandable_segments:True" | ||
| TRL_EXPERIMENTAL_SILENCE: 1 | ||
|
|
||
| jobs: | ||
| check_code_quality: | ||
| name: Check code quality | ||
| runs-on: ubuntu-latest | ||
| if: github.event.pull_request.draft == false | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python 3.13 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: 3.13 | ||
| - uses: pre-commit/[email protected] | ||
| with: | ||
| extra_args: --all-files | ||
|
|
||
| tests: | ||
| name: Tests (experimental) | ||
| runs-on: | ||
| group: aws-g4dn-2xlarge | ||
| container: | ||
| image: pytorch/pytorch:2.8.0-cuda12.8-cudnn9-devel | ||
| options: --gpus all | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| steps: | ||
| - name: Git checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python 3.13 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: 3.13 | ||
|
|
||
| - name: Install Make and Git | ||
| run: | | ||
| apt-get update && apt-get install -y make git curl | ||
| - name: Install uv | ||
| run: | | ||
| curl -LsSf https://astral.sh/uv/install.sh | sh | ||
| - name: Create Python virtual environment | ||
| run: | | ||
| uv venv | ||
| uv pip install --upgrade setuptools wheel | ||
| - name: Install dependencies | ||
| run: | | ||
| source .venv/bin/activate | ||
| uv pip install ".[dev]" | ||
| - name: Test with pytest | ||
| run: | | ||
| source .venv/bin/activate | ||
| make test_experimental | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,12 +12,14 @@ on: | |
| - "tests/**.py" | ||
| - "trl/**.py" | ||
| - "pyproject.toml" | ||
| # Exclude if only experimental code/tests | ||
| - "!trl/experimental/**" | ||
| - "!tests/experimental/**" | ||
|
|
||
| env: | ||
| TQDM_DISABLE: 1 | ||
| CI_SLACK_CHANNEL: ${{ secrets.CI_PUSH_MAIN_CHANNEL }} | ||
| PYTORCH_CUDA_ALLOC_CONF: "expandable_segments:True" | ||
| TRL_EXPERIMENTAL_SILENCE: 1 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! |
||
|
|
||
| jobs: | ||
| check_code_quality: | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code quality is already checked in main test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @qgallouedec.
True: the workflow for regular tests already covers code quality checks.
However, I included it here to handle the case where only experimental code is modified. In that scenario, the regular tests (with code quality check) are not triggered. Therefore, the need to check it in this workflow.