Skip to content

Commit

Permalink
faster
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil committed Oct 27, 2024
1 parent bbd2000 commit 81c778a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true

jobs:
build:
quality:
strategy:
fail-fast: false
matrix:
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/test_openvino.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ jobs:
matrix:
test_pattern:
[
"test_export*",
"test_modeling*",
"test_modeling.py",
"test_modeling_basic.py",
"test_modeling_diffusion.py",
"test_modeling_sentence_transformers.py",
"test_quantization*",
"test_training*",
"test_export*",
]
transformers-version: ["4.36.0", "4.45.*"]
python-version: ["3.9"]
Expand Down Expand Up @@ -56,15 +59,15 @@ jobs:

- name: Test with Pytest
run: |
pytest tests/openvino/${{ matrix.test_pattern }}.py
pytest tests/openvino/${{ matrix.test_pattern }} --duration=0
env:
HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}

- name: Install nightly OpenVINO
- name: Install dependencies (nightly)
run: |
pip install --upgrade --pre openvino openvino-tokenizers --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly
- name: Test with Pytest
if: ${{ matrix.test_pattern == 'test_modeling*' }}
- name: Test with Pytest (nightly)
if: ${{ matrix.test_pattern == 'test_modeling_basic.py' }}
run: |
pytest tests/openvino/modeling_basic.py
2 changes: 1 addition & 1 deletion .github/workflows/test_openvino_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ jobs:

- name: Install dependencies
run: |
pip install .[openvino] jstyleson pytest
pip install -r examples/openvino/audio-classification/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
pip install -r examples/openvino/image-classification/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
pip install -r examples/openvino/question-answering/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
pip install -r examples/openvino/text-classification/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
pip install .[openvino] jstyleson pytest
- name: Test examples
run: |
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/test_openvino_notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,12 @@ jobs:

- name: Install dependencies
run: |
# Install PyTorch CPU to prevent unnecessary downloading/installing of CUDA packages
# ffmpeg, torchaudio and pillow are required for image classification and audio classification pipelines
# ffmpeg is required for image classification and audio classification pipelines
sudo apt-get install ffmpeg
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install -r notebooks/openvino/requirements.txt
pip install .[tests,openvino] nbval
- run: free -h
- run: lscpu
- run: pip freeze

- name: Test with Pytest
run: |
sed -i 's/NUM_TRAIN_ITEMS = 600/NUM_TRAIN_ITEMS = 10/' notebooks/openvino/question_answering_quantization.ipynb
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/test_openvino_slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ on:
branches:
- v*-release
pull_request:
types: [opened, synchronize, reopened, labeled]
types:
- opened
- labeled
- reopened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -20,6 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# TODO: testong python upper bound seems unnecessary
# Testing lower and upper bound of supported Python versions
# This also ensures that the test fails if dependencies break for Python 3.7
python-version: ["3.9", "3.12"]
Expand Down Expand Up @@ -47,33 +52,36 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- 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: |
python -m pip install --upgrade pip
# Install PyTorch CPU to prevent unnecessary downloading/installing of CUDA packages
pip install --upgrade pip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Install openvino manually to prevent dependency conflicts when .[openvino] pins
# optimum or transformers to a specific version
pip install ${{ matrix.openvino }}
pip install .[tests] transformers[testing]==${{ matrix.transformers-version }}
- name: Pip freeze
run: pip freeze
- name: Assert versions
run: |
python -c "import transformers; print(transformers.__version__); assert transformers.__version__.startswith('${{ matrix.transformers-version }}'.replace('.*', ''))"
- name: Test with Pytest
run: |
pytest tests/openvino/test_modeling_basic.py
- name: Slow tests
- name: Install dependencies (slow)
run: |
pip install ${{ matrix.nncf }}
pytest tests/openvino -s -m "run_slow" --durations=0
- name: Test with Pytest (slow)
run: |
pytest tests/openvino -m "run_slow" --durations=0
env:
RUN_SLOW: 1
HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}

0 comments on commit 81c778a

Please sign in to comment.