Skip to content

feat: pipeline-level quantization config #11130

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
merged 39 commits into from
May 9, 2025
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
316ff46
feat: pipeline-level quant config.
sayakpaul Mar 10, 2025
eec5b98
Revert "feat: pipeline-level quant config."
sayakpaul Mar 20, 2025
c94d85a
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Mar 20, 2025
4d3dede
feat: implement pipeline-level quantization config
sayakpaul Mar 21, 2025
dc79f32
update
sayakpaul Mar 21, 2025
df749e4
fixes
sayakpaul Mar 21, 2025
d0ad15e
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Mar 21, 2025
f8b514b
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Mar 26, 2025
9250941
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Mar 27, 2025
13d5589
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Apr 2, 2025
f678437
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Apr 10, 2025
5a85871
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Apr 11, 2025
557136d
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Apr 17, 2025
0d9814f
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Apr 21, 2025
f8d1bd1
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Apr 24, 2025
c7e0774
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Apr 25, 2025
6861da1
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Apr 28, 2025
82bcce0
fix validation.
sayakpaul Apr 29, 2025
78f134b
add tests and other improvements.
sayakpaul Apr 29, 2025
f2b39e0
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul Apr 29, 2025
3b76e0a
add tests
sayakpaul Apr 29, 2025
695061b
import quality
sayakpaul Apr 29, 2025
9693251
remove prints.
sayakpaul Apr 29, 2025
73f1ad1
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul May 1, 2025
dc90b06
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul May 2, 2025
872c91e
add docs.
sayakpaul May 2, 2025
fbdf4c6
fixes to docs.
sayakpaul May 2, 2025
da6df86
doc fixes.
sayakpaul May 2, 2025
9a418a9
doc fixes.
sayakpaul May 2, 2025
5b6ee10
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul May 3, 2025
478a353
add validation to the input quantization_config.
sayakpaul May 6, 2025
f96bcc7
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul May 6, 2025
0ae2a9a
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul May 8, 2025
d6b48ea
clarify recommendations.
sayakpaul May 8, 2025
ca2e116
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul May 8, 2025
ffb974f
docs
sayakpaul May 8, 2025
86ee773
add to ci.
sayakpaul May 8, 2025
037a68b
Merge branch 'main' into feat/pipeline-quant-config
sayakpaul May 9, 2025
7b8a73d
todo.
sayakpaul May 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add to ci.
  • Loading branch information
sayakpaul committed May 8, 2025
commit 86ee7735a7fab1f2a24351c876fc55fc19a1094c
54 changes: 54 additions & 0 deletions .github/workflows/nightly_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -525,118 +525,172 @@
pip install slack_sdk tabulate
python utils/log_reports.py >> $GITHUB_STEP_SUMMARY

run_nightly_pipeline_level_quantization_tests:
name: Torch quantization nightly tests
strategy:
fail-fast: false
max-parallel: 2
runs-on:
group: aws-g6e-xlarge-plus
container:
image: diffusers/diffusers-pytorch-cuda
options: --shm-size "20gb" --ipc host --gpus 0
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 bitsandbytes optimum_quanto
python -m uv pip install pytest-reportlog
- name: Environment
run: |
python utils/print_env.py
- name: Pipeline-level 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_pipeline_level_quant_torch_cuda \
--report-log=tests_pipeline_level_quant_torch_cuda.log \
tests/quantization/test_pipeline_level_quantization.py
- name: Failure short reports
if: ${{ failure() }}
run: |
cat reports/tests_pipeline_level_quant_torch_cuda_stats.txt
cat reports/tests_pipeline_level_quant_torch_cuda_failures_short.txt
- name: Test suite reports artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: torch_cuda_pipeline_level_quant_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:
# name: Nightly PyTorch MPS tests on MacOS
# runs-on: [ self-hosted, apple-m1 ]
# if: github.event_name == 'schedule'
#
# steps:
# - name: Checkout diffusers
# uses: actions/checkout@v3
# with:
# fetch-depth: 2
#
# - name: Clean checkout
# shell: arch -arch arm64 bash {0}
# run: |
# git clean -fxd
# - name: Setup miniconda
# uses: ./.github/actions/setup-miniconda
# with:
# python-version: 3.9
#
# - name: Install dependencies
# shell: arch -arch arm64 bash {0}
# run: |
# ${CONDA_RUN} python -m pip install --upgrade pip uv
# ${CONDA_RUN} python -m uv pip install -e [quality,test]
# ${CONDA_RUN} python -m uv pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
# ${CONDA_RUN} python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate
# ${CONDA_RUN} python -m uv pip install pytest-reportlog
# - name: Environment
# shell: arch -arch arm64 bash {0}
# run: |
# ${CONDA_RUN} python utils/print_env.py
# - name: Run nightly PyTorch tests on M1 (MPS)
# shell: arch -arch arm64 bash {0}
# env:
# HF_HOME: /System/Volumes/Data/mnt/cache
# HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
# run: |
# ${CONDA_RUN} python -m pytest -n 1 -s -v --make-reports=tests_torch_mps \
# --report-log=tests_torch_mps.log \
# tests/
# - name: Failure short reports
# if: ${{ failure() }}
# run: cat reports/tests_torch_mps_failures_short.txt
#
# - name: Test suite reports artifacts
# if: ${{ always() }}
# uses: actions/upload-artifact@v4
# with:
# name: torch_mps_test_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 run_nightly_tests_apple_m1:
# name: Nightly PyTorch MPS tests on MacOS
# runs-on: [ self-hosted, apple-m1 ]
# if: github.event_name == 'schedule'
#
# steps:
# - name: Checkout diffusers
# uses: actions/checkout@v3
# with:
# fetch-depth: 2
#
# - name: Clean checkout
# shell: arch -arch arm64 bash {0}
# run: |
# git clean -fxd
# - name: Setup miniconda
# uses: ./.github/actions/setup-miniconda
# with:
# python-version: 3.9
#
# - name: Install dependencies
# shell: arch -arch arm64 bash {0}
# run: |
# ${CONDA_RUN} python -m pip install --upgrade pip uv
# ${CONDA_RUN} python -m uv pip install -e [quality,test]
# ${CONDA_RUN} python -m uv pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
# ${CONDA_RUN} python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate
# ${CONDA_RUN} python -m uv pip install pytest-reportlog
# - name: Environment
# shell: arch -arch arm64 bash {0}
# run: |
# ${CONDA_RUN} python utils/print_env.py
# - name: Run nightly PyTorch tests on M1 (MPS)
# shell: arch -arch arm64 bash {0}
# env:
# HF_HOME: /System/Volumes/Data/mnt/cache
# HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
# run: |
# ${CONDA_RUN} python -m pytest -n 1 -s -v --make-reports=tests_torch_mps \
# --report-log=tests_torch_mps.log \
# tests/
# - name: Failure short reports
# if: ${{ failure() }}
# run: cat reports/tests_torch_mps_failures_short.txt
#
# - name: Test suite reports artifacts
# if: ${{ always() }}
# uses: actions/upload-artifact@v4
# with:
# name: torch_mps_test_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

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Loading