Skip to content

Commit a2700a8

Browse files
Test examples (#306)
1 parent 24f4531 commit a2700a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+324
-245
lines changed

.github/workflows/test_api_cpu.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,21 @@ jobs:
4747
pip install -e .[testing,timm,diffusers,codecarbon]
4848
4949
- name: Run tests
50+
run: |
51+
pytest tests/test_api.py -s -k "api and cpu"
5052
env:
5153
HF_TOKEN: ${{ secrets.HF_TOKEN }}
5254
PUSH_REPO_ID: optimum-benchmark/cpu
53-
run: |
54-
pytest tests/test_api.py -s -k "api and cpu"
55+
56+
# no examples for now
57+
# - if: ${{
58+
# (github.event_name == 'push') ||
59+
# (github.event_name == 'workflow_dispatch') ||
60+
# contains( github.event.pull_request.labels.*.name, 'examples')
61+
# }}
62+
# name: Run examples
63+
# run: |
64+
# pytest tests/test_examples.py -s -k "api and cpu"
65+
# env:
66+
# HF_TOKEN: ${{ secrets.HF_TOKEN }}
67+
# PUSH_REPO_ID: optimum-benchmark/cpu

.github/workflows/test_api_cuda.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,21 @@ jobs:
4545
pip install -e .[testing,timm,diffusers,codecarbon]
4646
4747
- name: Run tests
48+
run: |
49+
pytest tests/test_api.py -x -s -k "api and cuda"
4850
env:
4951
HF_TOKEN: ${{ secrets.HF_TOKEN }}
5052
PUSH_REPO_ID: optimum-benchmark/cuda
53+
54+
- if: ${{
55+
(github.event_name == 'push') ||
56+
(github.event_name == 'workflow_dispatch') ||
57+
contains( github.event.pull_request.labels.*.name, 'examples')
58+
}}
59+
name: Run examples
5160
run: |
52-
pytest tests/test_api.py -x -s -k "api and cuda"
61+
pip install -e .[testing,torchao,autoawq,auto-gptq]
62+
pytest tests/test_examples.py -x -s -k "api and cuda and pytorch"
63+
env:
64+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
65+
PUSH_REPO_ID: optimum-benchmark/cuda

.github/workflows/test_api_misc.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ jobs:
5858
UV_SYSTEM_PYTHON: 1
5959

6060
- name: Run tests
61+
run: |
62+
pytest tests/test_api.py -s -k "api and not (cpu or cuda or rocm or mps)"
6163
env:
6264
HF_TOKEN: ${{ secrets.HF_TOKEN }}
6365
PUSH_REPO_ID: optimum-benchmark/misc-${{ matrix.os }}-${{ matrix.python }}
64-
run: |
65-
pytest tests/test_api.py -s -k "api and not (cpu or cuda or rocm or mps)"

.github/workflows/test_cli_cpu_ipex.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,17 @@ jobs:
3636
- name: Checkout
3737
uses: actions/checkout@v4
3838

39-
- name: Set up Python 3.10
40-
uses: actions/setup-python@v5
41-
with:
42-
python-version: "3.10"
43-
4439
- name: Install requirements
4540
run: |
46-
pip install --upgrade pip
47-
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
4841
pip install -e .[testing,ipex,diffusers,timm]
4942
5043
- name: Run tests
5144
run: pytest tests/test_cli.py -s -k "cli and cpu and ipex"
45+
46+
- if: ${{
47+
(github.event_name == 'push') ||
48+
(github.event_name == 'workflow_dispatch') ||
49+
contains( github.event.pull_request.labels.*.name, 'examples')
50+
}}
51+
name: Run examples
52+
run: pytest tests/test_examples.py -s -k "cli and cpu and ipex"

.github/workflows/test_cli_cpu_llama_cpp.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,12 @@ jobs:
4848
pip install -e .[testing,llama-cpp]
4949
5050
- name: Run tests
51-
run: pytest tests/test_cli.py -s -k "llama_cpp"
51+
run: pytest tests/test_cli.py -s -k "cli and cpu and llama_cpp"
52+
53+
- if: ${{
54+
(github.event_name == 'push') ||
55+
(github.event_name == 'workflow_dispatch') ||
56+
contains( github.event.pull_request.labels.*.name, 'examples')
57+
}}
58+
name: Run examples
59+
run: pytest tests/test_examples.py -s -k "cli and cpu and llama_cpp"

.github/workflows/test_cli_cpu_onnxruntime.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,11 @@ jobs:
4949
5050
- name: Run tests
5151
run: pytest tests/test_cli.py -s -k "cli and cpu and onnxruntime"
52+
53+
- if: ${{
54+
(github.event_name == 'push') ||
55+
(github.event_name == 'workflow_dispatch') ||
56+
contains( github.event.pull_request.labels.*.name, 'examples')
57+
}}
58+
name: Run examples
59+
run: pytest tests/test_examples.py -s -k "cli and cpu and onnxruntime"

.github/workflows/test_cli_cpu_openvino.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ jobs:
3636
- name: Checkout
3737
uses: actions/checkout@v4
3838

39-
- name: Set up Python 3.10
40-
uses: actions/setup-python@v5
41-
with:
42-
python-version: "3.10"
43-
4439
- name: Install requirements
4540
run: |
46-
pip install --upgrade pip
4741
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
4842
pip install -e .[testing,openvino,diffusers,timm]
4943
5044
- name: Run tests
5145
run: pytest tests/test_cli.py -s -k "cli and cpu and openvino"
46+
47+
- if: ${{
48+
(github.event_name == 'push') ||
49+
(github.event_name == 'workflow_dispatch') ||
50+
contains( github.event.pull_request.labels.*.name, 'examples')
51+
}}
52+
name: Run examples
53+
run: pytest tests/test_examples.py -s -k "cli and cpu and openvino"

.github/workflows/test_cli_cpu_py_txi.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,16 @@ jobs:
4545
run: |
4646
pip install --upgrade pip
4747
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
48-
pip install -e .[testing,py-txi]
48+
pip install -e .[testing,py-txi] git+https://github.com/IlyasMoutawwakil/py-txi.git
4949
5050
- name: Run tests
5151
run: pytest tests/test_cli.py -s -k "cli and cpu and py_txi"
52+
53+
# no examples for now
54+
# - if: ${{
55+
# (github.event_name == 'push') ||
56+
# (github.event_name == 'workflow_dispatch') ||
57+
# contains( github.event.pull_request.labels.*.name, 'examples')
58+
# }}
59+
# name: Run examples
60+
# run: pytest tests/test_examples.py -s -k "cli and cpu and (tgi or tei)"

.github/workflows/test_cli_cpu_pytorch.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,12 @@ jobs:
4949
5050
- name: Run tests
5151
run: pytest tests/test_cli.py -s -k "cli and cpu and pytorch"
52+
53+
# no examples for now
54+
# - if: ${{
55+
# (github.event_name == 'push') ||
56+
# (github.event_name == 'workflow_dispatch') ||
57+
# contains( github.event.pull_request.labels.*.name, 'examples')
58+
# }}
59+
# name: Run examples
60+
# run: pytest tests/test_examples.py -s -k "cli and cpu and pytorch"

.github/workflows/test_cli_cuda_onnxruntime.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,12 @@ jobs:
4848
- name: Run tests
4949
run: |
5050
pytest tests/test_cli.py -x -s -k "cli and cuda and onnxruntime"
51+
52+
# no examples for now
53+
# - if: ${{
54+
# (github.event_name == 'push') ||
55+
# (github.event_name == 'workflow_dispatch') ||
56+
# contains( github.event.pull_request.labels.*.name, 'examples')
57+
# }}
58+
# name: Run examples
59+
# run: pytest tests/test_examples.py -x -s -k "cli and cuda and onnxruntime"

0 commit comments

Comments
 (0)