-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
[CI] Quantization workflow #29046
[CI] Quantization workflow #29046
Changes from all commits
3ee3d1a
3df06c1
69a3ac5
f36265f
7454355
c745704
8c34b96
7fc1a73
471cb7b
2f45fda
67cd706
99d0456
aca17cf
a796a5e
e60712d
9057c30
3e82d7b
34e6048
f9fe630
c5c5670
4c757b8
ce94146
4cb52b8
7506932
9209b46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -297,6 +297,56 @@ jobs: | |
name: ${{ matrix.machine_type }}_run_tests_torch_cuda_extensions_gpu_test_reports | ||
path: /workspace/transformers/reports/${{ matrix.machine_type }}_tests_torch_cuda_extensions_gpu | ||
|
||
run_tests_quantization_torch_gpu: | ||
name: Quantization tests | ||
Comment on lines
+300
to
+301
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. I am not sure if we intend to keep this in this workflow file. Isn't the goal to move this outside to a separate workflow file ? 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. I think we can keep it there for now and I'll move it outside in my PR |
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
machine_type: [single-gpu, multi-gpu] | ||
runs-on: ['${{ matrix.machine_type }}', nvidia-gpu, t4, daily-ci] | ||
container: | ||
image: huggingface/transformers-quantization-latest-gpu | ||
options: --gpus all --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/ | ||
needs: setup | ||
steps: | ||
- name: Update clone | ||
working-directory: /transformers | ||
run: git fetch && git checkout ${{ github.sha }} | ||
|
||
- name: Reinstall transformers in edit mode (remove the one installed during docker image build) | ||
working-directory: /transformers | ||
run: python3 -m pip uninstall -y transformers && python3 -m pip install -e . | ||
SunMarc marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+316
to
+318
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. @ydshieh I do not understand why we don't:
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. There is no deep reason for what we are doing currently: we just install
By using |
||
|
||
- name: NVIDIA-SMI | ||
run: | | ||
nvidia-smi | ||
|
||
- name: Environment | ||
working-directory: /transformers | ||
run: | | ||
python3 utils/print_env.py | ||
|
||
- name: Show installed libraries and their versions | ||
working-directory: /transformers | ||
run: pip freeze | ||
|
||
- name: Run quantization tests on GPU | ||
working-directory: /transformers | ||
run: | | ||
python3 -m pytest -v --make-reports=${{ matrix.machine_type }}_tests_quantization_torch_gpu tests/quantization | ||
|
||
- name: Failure short reports | ||
if: ${{ failure() }} | ||
continue-on-error: true | ||
run: cat /transformers/reports/${{ matrix.machine_type }}_tests_quantization_torch_gpu/failures_short.txt | ||
|
||
- name: "Test suite reports artifacts: ${{ matrix.machine_type }}_run_tests_quantization_torch_gpu" | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.machine_type }}_run_tests_quantization_torch_gpu | ||
path: /transformers/reports/${{ matrix.machine_type }}_tests_quantization_torch_gpu | ||
|
||
run_extract_warnings: | ||
name: Extract warnings in CI artifacts | ||
runs-on: ubuntu-22.04 | ||
|
@@ -307,7 +357,8 @@ jobs: | |
run_examples_gpu, | ||
run_pipelines_tf_gpu, | ||
run_pipelines_torch_gpu, | ||
run_all_tests_torch_cuda_extensions_gpu | ||
run_all_tests_torch_cuda_extensions_gpu, | ||
run_tests_quantization_torch_gpu, | ||
] | ||
steps: | ||
- name: Checkout transformers | ||
|
@@ -355,6 +406,7 @@ jobs: | |
run_pipelines_tf_gpu, | ||
run_pipelines_torch_gpu, | ||
run_all_tests_torch_cuda_extensions_gpu, | ||
run_tests_quantization_torch_gpu, | ||
run_extract_warnings | ||
] | ||
steps: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04 | ||
LABEL maintainer="Hugging Face" | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Use login shell to read variables from `~/.profile` (to pass dynamic created variables between RUN commands) | ||
SHELL ["sh", "-lc"] | ||
|
||
# The following `ARG` are mainly used to specify the versions explicitly & directly in this docker file, and not meant | ||
# to be used as arguments for docker build (so far). | ||
|
||
ARG PYTORCH='2.2.0' | ||
# Example: `cu102`, `cu113`, etc. | ||
ARG CUDA='cu118' | ||
|
||
RUN apt update | ||
RUN apt install -y git libsndfile1-dev tesseract-ocr espeak-ng python python3-pip ffmpeg | ||
RUN python3 -m pip install --no-cache-dir --upgrade pip | ||
|
||
ARG REF=main | ||
RUN git clone https://github.com/huggingface/transformers && cd transformers && git checkout $REF | ||
|
||
RUN [ ${#PYTORCH} -gt 0 ] && VERSION='torch=='$PYTORCH'.*' || VERSION='torch'; echo "export VERSION='$VERSION'" >> ~/.profile | ||
RUN echo torch=$VERSION | ||
# `torchvision` and `torchaudio` should be installed along with `torch`, especially for nightly build. | ||
# Currently, let's just use their latest releases (when `torch` is installed with a release version) | ||
RUN python3 -m pip install --no-cache-dir -U $VERSION torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/$CUDA | ||
Comment on lines
+23
to
+27
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. make sure at the end, we do get 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. Done ! I didn't have to move it after |
||
|
||
RUN python3 -m pip install --no-cache-dir -e ./transformers[dev-torch] | ||
|
||
RUN python3 -m pip install --no-cache-dir git+https://github.com/huggingface/accelerate@main#egg=accelerate | ||
|
||
# Add bitsandbytes for mixed int8 testing | ||
RUN python3 -m pip install --no-cache-dir bitsandbytes | ||
|
||
# Add auto-gptq for gtpq quantization testing | ||
RUN python3 -m pip install --no-cache-dir auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ | ||
|
||
# Add optimum for gptq quantization testing | ||
RUN python3 -m pip install --no-cache-dir git+https://github.com/huggingface/optimum@main#egg=optimum | ||
|
||
# Add aqlm for quantization testing | ||
RUN python3 -m pip install --no-cache-dir aqlm[gpu]==1.0.2 | ||
|
||
# Add autoawq for quantization testing | ||
RUN python3 -m pip install --no-cache-dir https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.8/autoawq-0.1.8+cu118-cp38-cp38-linux_x86_64.whl | ||
|
||
# When installing in editable mode, `transformers` is not recognized as a package. | ||
# this line must be added in order for python to be aware of transformers. | ||
RUN cd transformers && python3 setup.py develop |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1043,6 +1043,7 @@ def prepare_reports(title, header, reports, to_truncate=True): | |
"PyTorch pipelines": "run_tests_torch_pipeline_gpu", | ||
"TensorFlow pipelines": "run_tests_tf_pipeline_gpu", | ||
"Torch CUDA extension tests": "run_tests_torch_cuda_extensions_gpu_test_reports", | ||
"Quantization tests": "run_tests_quantization_torch_gpu", | ||
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. should be revised if we decide to move quantization tests outside this workflow file. |
||
} | ||
|
||
if ci_event in ["push", "Nightly CI"] or ci_event.startswith("Past CI"): | ||
|
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.
Just want to know if we intent to run
quantization
tests in a daily basis, or if we prefer to run them on each commit merged intomain
?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.
I think that it is better to run them on a daily basis. There are many slows tests too + I think that the quantization tests are not easily broken by changes in transformers. The bigger issue is the third party libraries that might introduce breaking changes. cc @younesbelkada
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.
Yes daily basis sounds great!
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.
OK