Skip to content

Commit

Permalink
revert some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZucker committed Aug 28, 2024
1 parent e034c51 commit 38deb6d
Showing 1 changed file with 18 additions and 51 deletions.
69 changes: 18 additions & 51 deletions .github/workflows/self-pr-slow-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
paths:
- "src/transformers/models/*/modeling_*.py"
- "tests/**/test_*.py"
issue_comment:
types: [created, edited, deleted]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -31,7 +29,7 @@ jobs:
runs-on: ubuntu-22.04
name: Find models to run slow tests
# Triggered only if the required label `run-slow` is added
if: ${{ contains(github.event.pull_request.labels.*.name, 'run-slow') }} || (${{ github.event.issue.pull_request }} && contains(github.event.comment.body,'/pytest') ) }}
if: ${{ contains(github.event.pull_request.labels.*.name, 'run-slow') }}
outputs:
models: ${{ steps.models_to_run.outputs.models }}
steps:
Expand All @@ -44,15 +42,6 @@ jobs:
run: |
echo "commit_message=$(git show -s --format=%s)" >> $GITHUB_ENV
- name: Parse comment and set machine type
if: github.event_name == 'issue_comment'
run: |
COMMENT=${{ github.event.comment.body }}
if [[ "$COMMENT" == *"--device"* ]]; then
DEVICE=$(echo "$COMMENT" | grep -oP '(?<=--device\s)\S+')
echo "machine_type=${DEVICE}" >> $GITHUB_OUTPUT
fi
- name: Get models to run slow tests
run: |
echo "${{ env.commit_message }}"
Expand All @@ -67,42 +56,30 @@ jobs:
echo "models=${{ env.models }}" >> $GITHUB_OUTPUT
run_models_gpu:
name: Run all tests for the model
if: ${{ needs.find_models_to_run.outputs.models != '[]' || github.event_name == 'issue_comment' }}
needs: find_models_to_run
strategy:
fail-fast: false
matrix:
folders: ${{ fromJson(needs.find_models_to_run.outputs.models) || '[]' }}
machine_type: [single-gpu, multi-gpu]
runs-on: ['${{ matrix.machine_type }}', nvidia-gpu, t4, ci]
container:
image: huggingface/transformers-all-latest-gpu
options: --gpus all --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
steps:
- name: Parse command from PR comment
if: ${{ github.event_name == 'issue_comment' }}
id: parse_command
run: |
comment="${{ github.event.comment.body }}"
if [[ "$comment" =~ /run[[:space:]]+pytest ]]; then
export pytest_command=$(echo "$comment" | sed -n 's/\/run[[:space:]]\+pytest[[:space:]]\+\(.*\)/\1/p')
echo "pytest_command=$pytest_command" >> $GITHUB_ENV
else
echo "Invalid command. Exiting."
exit 1
env:
pytest_command: ""

name: Run all tests for the model
# Triggered only `find_models_to_run` is triggered (label `run-slow` is added) which gives the models to run
# (either a new model PR or via a commit message)
if: ${{ needs.find_models_to_run.outputs.models != '[]' }}
needs: find_models_to_run
strategy:
fail-fast: false
matrix:
folders: ${{ fromJson(needs.find_models_to_run.outputs.models) }}
machine_type: [single-gpu, multi-gpu]
runs-on: ['${{ matrix.machine_type }}', nvidia-gpu, t4, ci]
container:
image: huggingface/transformers-all-latest-gpu
options: --gpus all --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
steps:
- name: Echo input and matrix info
if: ${{ github.event_name == 'pull_request' || env.pytest_command != '' }}
shell: bash
run: |
echo "${{ matrix.folders }}"
- name: Echo folder ${{ matrix.folders }}
if: ${{ github.event_name == 'pull_request' || env.pytest_command != '' }}
shell: bash
# For folders like `models/bert`, set an env. var. (`matrix_folders`) to `models_bert`, which will be used to
# set the artifact folder names (because the character `/` is not allowed).
run: |
echo "${{ matrix.folders }}"
matrix_folders=${{ matrix.folders }}
Expand Down Expand Up @@ -138,16 +115,6 @@ jobs:
echo $CUDA_VISIBLE_DEVICES
python3 -m pytest -v -rsfE --make-reports=${{ matrix.machine_type }}_run_models_gpu_${{ matrix.folders }}_test_reports tests/${{ matrix.folders }}
- name: Run custom tests from comment
working-directory: /transformers
if: ${{ github.event_name == 'issue_comment' && env.pytest_command != '' }}
run: |
export CUDA_VISIBLE_DEVICES="$(python3 utils/set_cuda_devices_for_ci.py)"
echo $CUDA_VISIBLE_DEVICES
python3 -m pytest -v ${{ env.pytest_command }}
- name: Failure short reports
if: ${{ failure() }}
continue-on-error: true
Expand Down

0 comments on commit 38deb6d

Please sign in to comment.