Skip to content
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

Make the CI stable (no random failures), faster (8 intel cpus) and better orchestrated #1896

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
79 changes: 23 additions & 56 deletions .github/workflows/build_main_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,87 +13,54 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
repository: 'huggingface/doc-builder'
tool-cache: false
swap-storage: false
large-packages: false

- uses: actions/checkout@v4
with:
repository: "huggingface/doc-builder"
path: doc-builder

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/doc-build'
repository: "huggingface/doc-build"
path: doc-build
token: ${{ secrets.HUGGINGFACE_PUSH }}

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum'
repository: "huggingface/optimum"
path: optimum

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum-habana'
repository: "huggingface/optimum-habana"
path: optimum-habana

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum-intel'
repository: "huggingface/optimum-intel"
path: optimum-intel

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum-furiosa'
repository: "huggingface/optimum-furiosa"
path: optimum-furiosa

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum-amd'
repository: "huggingface/optimum-amd"
path: optimum-amd

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum-tpu'
repository: "huggingface/optimum-tpu"
path: optimum-tpu

- name: Free disk space
run: |
df -h
sudo apt-get purge -y '^apache.*'
sudo apt-get purge -y '^imagemagick.*'
sudo apt-get purge -y '^dotnet.*'
sudo apt-get purge -y '^aspnetcore.*'
sudo apt-get purge -y 'php.*'
sudo apt-get purge -y '^temurin.*'
sudo apt-get purge -y '^mysql.*'
sudo apt-get purge -y '^java.*'
sudo apt-get purge -y '^openjdk.*'
sudo apt-get purge -y microsoft-edge-stable google-cloud-cli azure-cli google-chrome-stable firefox powershell mono-devel
df -h
sudo apt-get autoremove -y >/dev/null 2>&1
sudo apt-get clean
df -h
echo "https://github.com/actions/virtual-environments/issues/709"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
echo "remove big /usr/local"
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf /usr/local/lib/android >/dev/null 2>&1
df -h
echo "remove /usr/share leftovers"
sudo rm -rf /usr/share/dotnet/sdk > /dev/null 2>&1
sudo rm -rf /usr/share/dotnet/shared > /dev/null 2>&1
sudo rm -rf /usr/share/swift > /dev/null 2>&1
df -h
echo "remove other leftovers"
sudo rm -rf /var/lib/mysql > /dev/null 2>&1
sudo rm -rf /home/runner/.dotnet > /dev/null 2>&1
sudo rm -rf /home/runneradmin/.dotnet > /dev/null 2>&1
sudo rm -rf /etc/skel/.dotnet > /dev/null 2>&1
sudo rm -rf /usr/local/.ghcup > /dev/null 2>&1
sudo rm -rf /usr/local/aws-cli > /dev/null 2>&1
sudo rm -rf /usr/lib/heroku > /dev/null 2>&1
sudo rm -rf /usr/local/share/chromium > /dev/null 2>&1
df -h

- name: Set environment variables
run: |
cd optimum
Expand Down
33 changes: 17 additions & 16 deletions .github/workflows/build_pr_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build PR documentation
on:
workflow_dispatch:
pull_request:
branches: [ main ]
branches: [main]
paths:
- "optimum/**.py"
- "docs/**.mdx"
Expand All @@ -23,46 +23,47 @@ jobs:
PR_CLONE_URL: ${{ github.event.pull_request.head.repo.clone_url }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/doc-builder'
repository: "huggingface/doc-builder"
path: doc-builder

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum'
repository: "huggingface/optimum"
path: optimum

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum-habana'
repository: "huggingface/optimum-habana"
path: optimum-habana

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum-intel'
repository: "huggingface/optimum-intel"
path: optimum-intel

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum-furiosa'
repository: "huggingface/optimum-furiosa"
path: optimum-furiosa

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum-amd'
repository: "huggingface/optimum-amd"
path: optimum-amd

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'huggingface/optimum-tpu'
repository: "huggingface/optimum-tpu"
path: optimum-tpu

- name: Setup environment
run: |
pip install --upgrade pip
pip uninstall -y doc-builder
cd doc-builder
git pull origin main
git pull origin main
pip install .
pip install black
cd ..
Expand Down
53 changes: 20 additions & 33 deletions .github/workflows/check_code_quality.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
name: check_code_quality
name: Code quality

on:
push:
branches: [ main ]
paths:
- "optimum/**.py"
- "tests/**.py"
- "examples/**.py"
branches: [main]

pull_request:
branches: [ main ]
paths:
- "optimum/**.py"
- "tests/**.py"
- "examples/**.py"
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -29,25 +21,20 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Create and start a virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
source venv/bin/activate
pip install --upgrade pip
pip install .[quality]
- name: Check style with black
run: |
source venv/bin/activate
black --check .
- name: Check style with ruff
run: |
source venv/bin/activate
ruff .
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install --upgrade pip
pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[quality]

- name: Check style
run: |
make style_check
40 changes: 22 additions & 18 deletions .github/workflows/test_benckmark.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Benchmark suite / Python - Test

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -18,19 +16,25 @@ jobs:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
os: [ubuntu-20.04]

runs-on: ${{ matrix.os }}
runs-on: [intel-cpu, 8-cpu, ci]

steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install wheel
pip install .[tests,onnxruntime,benchmark]
- name: Test with unittest
run: |
python -m unittest discover --start-directory tests/benchmark --pattern 'test_*.py'
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install --upgrade pip
pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[tests,onnxruntime,benchmark]

- name: Test with pytest
working-directory: tests
run: |
pytest benchmark -s -vvvv --durations=0
21 changes: 10 additions & 11 deletions .github/workflows/test_bettertransformer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,34 @@ jobs:
matrix:
python-version: [3.8, 3.9]
os: [ubuntu-20.04, macos-13]
exclude: [{ python-version: 3.8, os: macos-13 }]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
- name: Install dependencies 1
run: |
pip install --upgrade pip
pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[tests]
pip install --no-cache-dir --upgrade torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install accelerate

- name: Test with stable pytorch
- name: Test with pytest (stable pytorch)
working-directory: tests
run: |
pytest bettertransformer -s -vvvvv
pytest bettertransformer -n auto -s -vvvvv --durations=0

- name: Install dependencies 2
run: |
pip uninstall -y torch torchvision torchaudio
pip install --no-cache-dir --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
pip install --no-cache-dir --upgrade --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu

- name: Test with nightly pytorch
- name: Test with pytest (nightly pytorch)
working-directory: tests
run: |
pytest bettertransformer -s -vvvvv
pytest bettertransformer -n auto -s -vvvvv --durations=0
10 changes: 6 additions & 4 deletions .github/workflows/test_cli.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Optimum CLI / Python - Test

on:
Expand All @@ -21,6 +19,7 @@ jobs:
os: [ubuntu-20.04, macos-13]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -33,9 +32,12 @@ jobs:
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install --no-cache-dir torch==2.1.2 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[tests,exporters,exporters-tf]

- name: Test with pytest
working-directory: tests
env:
HF_HOME: /mnt/cache/.cache/huggingface
run: |
pytest tests/cli -s -vvvv --durations=0
pytest cli -s -vvvv --durations=0
Loading
Loading