Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 7.3k
[CI] Add quantization#9832
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
Uh oh!
There was an error while loading. Please reload this page.
[CI] Add quantization #9832
Changes from all commits
e27d7c3737405d3628c7b356c52512849bc2d53f88d9bbd38ee6d836110004bac8afd8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -347,6 +347,64 @@ jobs: | ||
| pip install slack_sdk tabulate | ||
| python utils/log_reports.py >> $GITHUB_STEP_SUMMARY | ||
| run_nightly_quantization_tests: | ||
| name: Torch quantization nightly tests | ||
| strategy: | ||
| fail-fast: false | ||
| max-parallel: 2 | ||
| matrix: | ||
| config: | ||
| - backend: "bitsandbytes" | ||
| test_location: "bnb" | ||
| runs-on: | ||
| group: aws-g6e-xlarge-plus | ||
| container: | ||
| image: diffusers/diffusers-pytorch-cuda | ||
| options: --shm-size "20gb" --ipc host --gpus 0 | ||
MemberAuthor 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. Using a large shared memory here. | ||
| steps: | ||
| - name: Checkout diffusers | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 2 | ||
| - name: NVIDIA-SMI | ||
| run: nvidia-smi | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" | ||
| python -m uv pip install -e [quality,test] | ||
| python -m uv pip install -U ${{ matrix.config.backend }} | ||
| python -m uv pip install pytest-reportlog | ||
| - name: Environment | ||
| run: | | ||
| python utils/print_env.py | ||
| - name: ${{ matrix.config.backend }} quantization tests on GPU | ||
| env: | ||
| HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }} | ||
| # https://pytorch.org/docs/stable/notes/randomness.html#avoiding-nondeterministic-algorithms | ||
| CUBLAS_WORKSPACE_CONFIG: :16:8 | ||
| BIG_GPU_MEMORY: 40 | ||
| run: | | ||
| python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \ | ||
| --make-reports=tests_${{ matrix.config.backend }}_torch_cuda \ | ||
| --report-log=tests_${{ matrix.config.backend }}_torch_cuda.log \ | ||
| tests/quantization/${{ matrix.config.test_location }} | ||
| - name: Failure short reports | ||
| if: ${{ failure() }} | ||
| run: | | ||
| cat reports/tests_${{ matrix.config.backend }}_torch_cuda_stats.txt | ||
| cat reports/tests_${{ matrix.config.backend }}_torch_cuda_failures_short.txt | ||
| - name: Test suite reports artifacts | ||
| if: ${{ always() }} | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: torch_cuda_${{ matrix.config.backend }}_reports | ||
| path: reports | ||
| - name: Generate Report and Notify Channel | ||
| if: always() | ||
| run: | | ||
| pip install slack_sdk tabulate | ||
| python utils/log_reports.py >> $GITHUB_STEP_SUMMARY | ||
| # M1 runner currently not well supported | ||
| # TODO: (Dhruv) add these back when we setup better testing for Apple Silicon | ||
| # run_nightly_tests_apple_m1: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -369,7 +369,7 @@ def test_quality(self): | ||
| output_type="np", | ||
| ).images | ||
| out_slice = output[0, -3:, -3:, -1].flatten() | ||
| expected_slice = np.array([0.0149, 0.0322, 0.0073, 0.0134, 0.0332, 0.011, 0.002, 0.0232, 0.0193]) | ||
| expected_slice = np.array([0.0376, 0.0359, 0.0015, 0.0449, 0.0479, 0.0098, 0.0083, 0.0295, 0.0295]) | ||
MemberAuthor 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. Because of the machine change. | ||
| max_diff = numpy_cosine_similarity_distance(expected_slice, out_slice) | ||
| self.assertTrue(max_diff < 1e-2) | ||
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.
Decided to go with a matrix strategy to accommodate for future backends.