From 9dbb1d4ded9f73493c27c754d218a51d4ff82a51 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Thu, 28 Nov 2024 16:01:23 +0530 Subject: [PATCH 1/2] merge peft pr workflow into the main pr workflow. --- .github/workflows/pr_test_peft_backend.yml | 134 --------------------- .github/workflows/pr_tests.yml | 72 +++++++++++ 2 files changed, 72 insertions(+), 134 deletions(-) delete mode 100644 .github/workflows/pr_test_peft_backend.yml diff --git a/.github/workflows/pr_test_peft_backend.yml b/.github/workflows/pr_test_peft_backend.yml deleted file mode 100644 index 190e5d26e6f3..000000000000 --- a/.github/workflows/pr_test_peft_backend.yml +++ /dev/null @@ -1,134 +0,0 @@ -name: Fast tests for PRs - PEFT backend - -on: - pull_request: - branches: - - main - paths: - - "src/diffusers/**.py" - - "tests/**.py" - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -env: - DIFFUSERS_IS_CI: yes - OMP_NUM_THREADS: 4 - MKL_NUM_THREADS: 4 - PYTEST_TIMEOUT: 60 - -jobs: - check_code_quality: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install .[quality] - - name: Check quality - run: make quality - - name: Check if failure - if: ${{ failure() }} - run: | - echo "Quality check failed. Please ensure the right dependency versions are installed with 'pip install -e .[quality]' and run 'make style && make quality'" >> $GITHUB_STEP_SUMMARY - - check_repository_consistency: - needs: check_code_quality - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install .[quality] - - name: Check repo consistency - run: | - python utils/check_copies.py - python utils/check_dummies.py - make deps_table_check_updated - - name: Check if failure - if: ${{ failure() }} - run: | - echo "Repo consistency check failed. Please ensure the right dependency versions are installed with 'pip install -e .[quality]' and run 'make fix-copies'" >> $GITHUB_STEP_SUMMARY - - run_fast_tests: - needs: [check_code_quality, check_repository_consistency] - strategy: - fail-fast: false - matrix: - lib-versions: ["main", "latest"] - - - name: LoRA - ${{ matrix.lib-versions }} - - runs-on: - group: aws-general-8-plus - - container: - image: diffusers/diffusers-pytorch-cpu - options: --shm-size "16gb" --ipc host -v /mnt/hf_cache:/mnt/cache/ - - defaults: - run: - shell: bash - - steps: - - name: Checkout diffusers - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Install dependencies - run: | - python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" - python -m uv pip install -e [quality,test] - # TODO (sayakpaul, DN6): revisit `--no-deps` - if [ "${{ matrix.lib-versions }}" == "main" ]; then - python -m pip install -U peft@git+https://github.com/huggingface/peft.git --no-deps - python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps - pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps - else - python -m uv pip install -U peft --no-deps - python -m uv pip install -U transformers accelerate --no-deps - fi - - - name: Environment - run: | - python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" - python utils/print_env.py - - - name: Run fast PyTorch LoRA CPU tests with PEFT backend - run: | - python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" - python -m pytest -n 4 --max-worker-restart=0 --dist=loadfile \ - -s -v \ - --make-reports=tests_${{ matrix.lib-versions }} \ - tests/lora/ - python -m pytest -n 4 --max-worker-restart=0 --dist=loadfile \ - -s -v \ - --make-reports=tests_models_lora_${{ matrix.lib-versions }} \ - tests/models/ -k "lora" - - - - name: Failure short reports - if: ${{ failure() }} - run: | - cat reports/tests_${{ matrix.lib-versions }}_failures_short.txt - cat reports/tests_models_lora_${{ matrix.lib-versions }}_failures_short.txt - - - name: Test suite reports artifacts - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: pr_${{ matrix.lib-versions }}_test_reports - path: reports diff --git a/.github/workflows/pr_tests.yml b/.github/workflows/pr_tests.yml index ec3e55a5e882..88fe4653336f 100644 --- a/.github/workflows/pr_tests.yml +++ b/.github/workflows/pr_tests.yml @@ -234,3 +234,75 @@ jobs: with: name: pr_${{ matrix.config.report }}_test_reports path: reports + + run_lora_tests: + needs: [check_code_quality, check_repository_consistency] + strategy: + fail-fast: false + matrix: + lib-versions: ["main", "latest"] + + name: LoRA - ${{ matrix.lib-versions }} + + runs-on: + group: aws-general-8-plus + + container: + image: diffusers/diffusers-pytorch-cpu + options: --shm-size "16gb" --ipc host -v /mnt/hf_cache:/mnt/cache/ + + defaults: + run: + shell: bash + + steps: + - name: Checkout diffusers + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Install dependencies + run: | + python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" + python -m uv pip install -e [quality,test] + # TODO (sayakpaul, DN6): revisit `--no-deps` + if [ "${{ matrix.lib-versions }}" == "main" ]; then + python -m pip install -U peft@git+https://github.com/huggingface/peft.git --no-deps + python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps + pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps + else + python -m uv pip install -U peft --no-deps + python -m uv pip install -U transformers accelerate --no-deps + fi + + - name: Environment + run: | + python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" + python utils/print_env.py + + - name: Run fast PyTorch LoRA CPU tests with PEFT backend + run: | + python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" + python -m pytest -n 4 --max-worker-restart=0 --dist=loadfile \ + -s -v \ + --make-reports=tests_${{ matrix.lib-versions }} \ + tests/lora/ + python -m pytest -n 4 --max-worker-restart=0 --dist=loadfile \ + -s -v \ + --make-reports=tests_models_lora_${{ matrix.lib-versions }} \ + tests/models/ -k "lora" + + + - name: Failure short reports + if: ${{ failure() }} + run: | + cat reports/tests_${{ matrix.lib-versions }}_failures_short.txt + cat reports/tests_models_lora_${{ matrix.lib-versions }}_failures_short.txt + + - name: Test suite reports artifacts + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: pr_${{ matrix.lib-versions }}_test_reports + path: reports + From 6ffd18c11fa92d8a36269f80de96d38b8b2d13d8 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Mon, 2 Dec 2024 14:18:40 +0530 Subject: [PATCH 2/2] remove latest --- .github/workflows/pr_tests.yml | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pr_tests.yml b/.github/workflows/pr_tests.yml index 88fe4653336f..025787606a9c 100644 --- a/.github/workflows/pr_tests.yml +++ b/.github/workflows/pr_tests.yml @@ -239,10 +239,8 @@ jobs: needs: [check_code_quality, check_repository_consistency] strategy: fail-fast: false - matrix: - lib-versions: ["main", "latest"] - name: LoRA - ${{ matrix.lib-versions }} + name: LoRA tests with PEFT main runs-on: group: aws-general-8-plus @@ -266,43 +264,37 @@ jobs: python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" python -m uv pip install -e [quality,test] # TODO (sayakpaul, DN6): revisit `--no-deps` - if [ "${{ matrix.lib-versions }}" == "main" ]; then - python -m pip install -U peft@git+https://github.com/huggingface/peft.git --no-deps - python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps - pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps - else - python -m uv pip install -U peft --no-deps - python -m uv pip install -U transformers accelerate --no-deps - fi + python -m pip install -U peft@git+https://github.com/huggingface/peft.git --no-deps + python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps + pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps - name: Environment run: | python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" python utils/print_env.py - - name: Run fast PyTorch LoRA CPU tests with PEFT backend + - name: Run fast PyTorch LoRA tests with PEFT run: | python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" python -m pytest -n 4 --max-worker-restart=0 --dist=loadfile \ -s -v \ - --make-reports=tests_${{ matrix.lib-versions }} \ + --make-reports=tests_peft_main \ tests/lora/ python -m pytest -n 4 --max-worker-restart=0 --dist=loadfile \ -s -v \ - --make-reports=tests_models_lora_${{ matrix.lib-versions }} \ + --make-reports=tests_models_lora_peft_main \ tests/models/ -k "lora" - - name: Failure short reports if: ${{ failure() }} run: | - cat reports/tests_${{ matrix.lib-versions }}_failures_short.txt - cat reports/tests_models_lora_${{ matrix.lib-versions }}_failures_short.txt + cat reports/tests_lora_failures_short.txt + cat reports/tests_models_lora_failures_short.txt - name: Test suite reports artifacts if: ${{ always() }} uses: actions/upload-artifact@v4 with: - name: pr_${{ matrix.lib-versions }}_test_reports + name: pr_main_test_reports path: reports