Skip to content

Commit

Permalink
Merge branch 'main' into energy_star_pr
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil committed Nov 19, 2024
2 parents 330ae71 + 08c9f59 commit c3aa25d
Show file tree
Hide file tree
Showing 86 changed files with 1,587 additions and 1,869 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Quality Checks

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
cancel-in-progress: true
Expand Down
27 changes: 14 additions & 13 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ name: Security Checks
on:
push:

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: read

jobs:
secrets:
trufflehog:
runs-on: ubuntu-latest
steps:
- name: Set up environment variables
shell: bash
- shell: bash
run: |
if [ "${{ github.event_name }}" == "push" ]; then
echo "depth=$(($(jq length <<< '${{ toJson(github.event.commits) }}') + 2))" >> $GITHUB_ENV
echo "branch=${{ github.ref_name }}" >> $GITHUB_ENV
if [ "$EVENT_NAME" == "push" ]; then
echo "depth=$(($(jq length <<< $COMMITS)+2))" >> $GITHUB_ENV
echo "branch=$REF" >> $GITHUB_ENV
fi
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "depth=$((${{ github.event.pull_request.commits }}+2))" >> $GITHUB_ENV
echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
if [ "$EVENT_NAME" == "pull_request" ]; then
echo "depth=$(($PR_COMMITS+2))" >> $GITHUB_ENV
echo "branch=$PR_REF" >> $GITHUB_ENV
fi
env:
REF: ${{ github.ref_name }}
COMMITS: ${{ tojson(github.event.commits) }}
EVENT_NAME: ${{ github.event_name }}
PR_REF: ${{ github.event.pull_request.head.ref }}
PR_COMMITS: ${{ github.event.pull_request.commits }}

- name: Checkout code
uses: actions/checkout@v4
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/test_api_cpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,30 @@ on:
push:
branches:
- main
paths:
- .github/workflows/test_api_cpu.yaml
- "optimum_benchmark/**"
- "docker/**"
- "tests/**"
- "setup.py"
pull_request:
branches:
- main
paths:
- .github/workflows/test_api_cpu.yaml
- "optimum_benchmark/**"
- "docker/**"
- "tests/**"
- "setup.py"
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

jobs:
run_api_cpu_tests:
if: ${{
(github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch') ||
contains( github.event.pull_request.labels.*.name, 'api') ||
contains( github.event.pull_request.labels.*.name, 'cpu') ||
contains( github.event.pull_request.labels.*.name, 'api_cpu')
}}

runs-on: ubuntu-latest

steps:
Expand All @@ -49,4 +51,4 @@ jobs:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
PUSH_REPO_ID: optimum-benchmark/cpu
run: |
pytest -s -k "api and cpu"
pytest tests/test_api.py -s -k "api and cpu"
57 changes: 26 additions & 31 deletions .github/workflows/test_api_cuda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,48 @@ on:
push:
branches:
- main
paths:
- .github/workflows/test_api_cuda.yaml
- "optimum_benchmark/**"
- "docker/**"
- "tests/**"
- "setup.py"
pull_request:
branches:
- main
paths:
- .github/workflows/test_api_cuda.yaml
- "optimum_benchmark/**"
- "docker/**"
- "tests/**"
- "setup.py"
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

env:
IMAGE: ghcr.io/huggingface/optimum-benchmark:latest-cuda

jobs:
run_api_cuda_tests:
runs-on: [single-gpu, nvidia-gpu, a10, ci]
if: ${{
(github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch') ||
contains( github.event.pull_request.labels.*.name, 'api') ||
contains( github.event.pull_request.labels.*.name, 'cuda') ||
contains( github.event.pull_request.labels.*.name, 'api_cuda')
}}

runs-on:
group: aws-g5-4xlarge-plus

container:
image: ghcr.io/huggingface/optimum-benchmark:latest-cuda
options: --ipc host --gpus all

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

- name: Install dependencies
run: |
pip install -e .[testing,timm,diffusers,codecarbon]
- name: Run tests
uses: addnab/docker-run-action@v3
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
PUSH_REPO_ID: optimum-benchmark/cuda
with:
image: ${{ env.IMAGE }}
options: |
--rm
--gpus all
--shm-size 64G
--env HF_TOKEN
--env PUSH_REPO_ID
--env MKL_THREADING_LAYER=GNU
--volume ${{ github.workspace }}:/workspace
--workdir /workspace
run: |
pip install -e .[testing,timm,diffusers,codecarbon]
pytest -s -x -k "api and cuda"
run: |
pytest tests/test_api.py -x -s -k "api and cuda"
44 changes: 27 additions & 17 deletions .github/workflows/test_api_misc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,48 @@ on:
push:
branches:
- main
paths:
- .github/workflows/test_api_misc.yaml
- "optimum_benchmark/**"
- "docker/**"
- "tests/**"
- "setup.py"
pull_request:
branches:
- main
paths:
- .github/workflows/test_api_misc.yaml
- "optimum_benchmark/**"
- "docker/**"
- "tests/**"
- "setup.py"
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

jobs:
run_api_misc_tests:
runs-on: ubuntu-latest
if: ${{
(github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch') ||
contains( github.event.pull_request.labels.*.name, 'api') ||
contains( github.event.pull_request.labels.*.name, 'misc') ||
contains( github.event.pull_request.labels.*.name, 'api_misc')
}}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, "macos-latest", windows-latest]
python: ["3.8", "3.12"]

name: OS ${{ matrix.os }} - Python ${{ matrix.python }}

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

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

- name: Set up Python 3.10
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: ${{ matrix.python }}

- name: Install requirements
run: |
Expand All @@ -47,6 +57,6 @@ jobs:
- name: Run tests
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
PUSH_REPO_ID: optimum-benchmark/misc
PUSH_REPO_ID: optimum-benchmark/misc-${{ matrix.os }}-${{ matrix.python }}
run: |
pytest -s -k "api and not (cpu or cuda or rocm or mps)"
pytest tests/test_api.py -s -k "api and not (cpu or cuda or rocm or mps)"
29 changes: 15 additions & 14 deletions .github/workflows/test_api_rocm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,30 @@ on:
push:
branches:
- main
paths:
- .github/workflows/test_api_rocm.yaml
- "optimum_benchmark/**"
- "docker/**"
- "tests/**"
- "setup.py"
pull_request:
branches:
- main
paths:
- .github/workflows/test_api_rocm.yaml
- "optimum_benchmark/**"
- "docker/**"
- "tests/**"
- "setup.py"
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

jobs:
run_api_rocm_tests:
if: ${{
(github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch') ||
contains( github.event.pull_request.labels.*.name, 'api') ||
contains( github.event.pull_request.labels.*.name, 'rocm') ||
contains( github.event.pull_request.labels.*.name, 'api_rocm')
}}

runs-on: [self-hosted, amd-gpu, single-gpu]

container:
Expand All @@ -38,7 +40,6 @@ jobs:
--device /dev/dri
--env ROCR_VISIBLE_DEVICES
--env HIP_VISIBLE_DEVICES=0
--volume /mnt/cache/.cache/huggingface:/mnt/cache/

steps:
- name: Checkout
Expand All @@ -53,4 +54,4 @@ jobs:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
PUSH_REPO_ID: optimum-benchmark/rocm
run: |
pytest -s -x -k "api and cuda"
pytest tests/test_api.py -x -s -k "api and cuda"
29 changes: 16 additions & 13 deletions .github/workflows/test_cli_cpu_ipex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,31 @@ on:
push:
branches:
- main
paths:
- .github/workflows/test_cli_cpu_ipex.yaml
- "optimum_benchmark/**"
- "docker/**"
- "tests/**"
- "setup.py"
pull_request:
branches:
- main
paths:
- .github/workflows/test_cli_cpu_ipex.yaml
- "optimum_benchmark/**"
- "docker/**"
- "tests/**"
- "setup.py"
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

jobs:
run_cli_cpu_ipex_tests:
if: ${{
(github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch') ||
contains( github.event.pull_request.labels.*.name, 'cli') ||
contains( github.event.pull_request.labels.*.name, 'cpu') ||
contains( github.event.pull_request.labels.*.name, 'ipex') ||
contains( github.event.pull_request.labels.*.name, 'cli_cpu_ipex')
}}

runs-on: ubuntu-latest

steps:
Expand All @@ -45,4 +48,4 @@ jobs:
pip install -e .[testing,ipex,diffusers,timm]
- name: Run tests
run: pytest -s -k "cli and cpu and ipex"
run: pytest tests/test_cli.py -s -k "cli and cpu and ipex"
Loading

0 comments on commit c3aa25d

Please sign in to comment.