From 38deb6d88f073421d7e72dfbf33d28561ac3c908 Mon Sep 17 00:00:00 2001 From: Arthur Zucker Date: Wed, 28 Aug 2024 16:22:10 +0200 Subject: [PATCH] revert some changes --- .github/workflows/self-pr-slow-ci.yml | 69 +++++++-------------------- 1 file changed, 18 insertions(+), 51 deletions(-) diff --git a/.github/workflows/self-pr-slow-ci.yml b/.github/workflows/self-pr-slow-ci.yml index 56124e36f748f3..2287b5e3f31587 100644 --- a/.github/workflows/self-pr-slow-ci.yml +++ b/.github/workflows/self-pr-slow-ci.yml @@ -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 }} @@ -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: @@ -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 }}" @@ -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 }} @@ -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