Skip to content

Commit

Permalink
Add transformers 4.46 compatiblity (#2078)
Browse files Browse the repository at this point in the history
* transformers 4.46

* setup

* uupdate setup

* fix t5

* update python (3.8 eol)

* fix onnx test

* fixed deberta, onnxruntime tests in series passing

* fix bt

* fixed t5_forward for real, because it's also used by blip-2 as well

* fix Phi3

* fix opt

* vision encoder decoder

* fix setup

* style

* fix encoder decoder

* fixed transformers branch

* branch

* allow 4.47

* remove patch

* add opt

* add test

* fix OPT ONNX  export and inference

* add test

* update setup

* style

* merge tests

* update tes num beams

* add test transformers version

* add architectures depending on transformers

* add warning

* revert

* update test generation length

* style

---------

Co-authored-by: IlyasMoutawwakil <[email protected]>
  • Loading branch information
echarlaix and IlyasMoutawwakil authored Oct 29, 2024
1 parent 4a39ae0 commit 6802a0c
Show file tree
Hide file tree
Showing 36 changed files with 541 additions and 304 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check_code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8]
python-version: [3.9]
os: [ubuntu-20.04]

runs-on: ${{ matrix.os }}
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/test_benckmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ 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 @@ -17,20 +17,20 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04]

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: 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'
- 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'
4 changes: 2 additions & 2 deletions .github/workflows/test_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04, macos-13]

runs-on: ${{ matrix.os }}
Expand All @@ -34,7 +34,7 @@ jobs:
run: |
pip install --upgrade pip
pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[tests,exporters,exporters-tf]
pip install .[tests,exporters-tf]
- name: Test with pytest
run: |
Expand Down
44 changes: 22 additions & 22 deletions .github/workflows/test_export_onnx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Exporters ONNX / 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 @@ -15,27 +15,27 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04]

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: Install dependencies for pytorch export
run: |
pip install .[tests,exporters]
- name: Test with unittest
working-directory: tests
run: |
pytest exporters/onnx/test_onnx_*.py -s -n auto -m "not tensorflow_test and not timm_test" --durations=0
- name: Install dependencies for tensorflow export
run: |
pip install .[tests,exporters-tf]
- name: Test with unittest
working-directory: tests
run: |
pytest exporters/onnx/test_onnx_*.py -n auto -m "tensorflow_test" -s --durations=0
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies for pytorch export
run: |
pip install .[tests,exporters]
- name: Test with unittest
working-directory: tests
run: |
pytest exporters/onnx/test_onnx_*.py -s -n auto -m "not tensorflow_test and not timm_test" --durations=0
- name: Install dependencies for tensorflow export
run: |
pip install .[tests,exporters-tf]
- name: Test with unittest
working-directory: tests
run: |
pytest exporters/onnx/test_onnx_*.py -n auto -m "tensorflow_test" -s --durations=0
30 changes: 15 additions & 15 deletions .github/workflows/test_export_onnx_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Exporters ONNX CLI / 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 @@ -15,20 +15,20 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04]

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: Install dependencies for pytorch export
run: |
pip install .[tests,exporters]
- name: Test with unittest
working-directory: tests
run: |
pytest exporters/onnx/test_exporters_onnx_cli.py -n auto -m "not tensorflow_test and not timm_test" -s --durations=0
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies for pytorch export
run: |
pip install .[tests,exporters]
- name: Test with unittest
working-directory: tests
run: |
pytest exporters/onnx/test_exporters_onnx_cli.py -n auto -m "not tensorflow_test and not timm_test" -s --durations=0
26 changes: 13 additions & 13 deletions .github/workflows/test_export_onnx_cli_timm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04]

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: Install dependencies for pytorch export
run: |
pip install .[tests,exporters]
- name: Test with unittest
working-directory: tests
run: |
RUN_SLOW=1 pytest exporters/onnx/test_exporters_onnx_cli.py -n auto -k "timm" -s --durations=0
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies for pytorch export
run: |
pip install .[tests,exporters]
- name: Test with unittest
working-directory: tests
run: |
RUN_SLOW=1 pytest exporters/onnx/test_exporters_onnx_cli.py -n auto -k "timm" -s --durations=0
27 changes: 13 additions & 14 deletions .github/workflows/test_export_onnx_timm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04]

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: Install dependencies for pytorch export
run: |
pip install .[tests,exporters]
- name: Test with unittest
working-directory: tests
run: |
RUN_SLOW=1 pytest exporters/onnx/ -s -n auto -k "timm" --durations=0
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies for pytorch export
run: |
pip install .[tests,exporters]
- name: Test with unittest
working-directory: tests
run: |
RUN_SLOW=1 pytest exporters/onnx/ -s -n auto -k "timm" --durations=0
2 changes: 1 addition & 1 deletion .github/workflows/test_exporters_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04]

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_exporters_slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04]

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_fx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04, macos-13]

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_offline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04]

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_onnx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04, macos-14]

runs-on: ${{ matrix.os }}
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/test_onnxruntime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
transformers-version: ["latest"]
os: [ubuntu-20.04, windows-2019, macos-13]
include:
- transformers-version: "4.45.*"
os: ubuntu-20.04

runs-on: ${{ matrix.os }}
steps:
Expand All @@ -33,17 +36,21 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

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

- 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]
- name: Install transformers ${{ matrix.transformers-version }}
if: ${{ matrix.transformers-version != 'latest' }}
run: pip install transformers==${{ matrix.transformers-version }}

- name: Test with pytest (in series)
working-directory: tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_onnxruntime_slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04]

runs-on: ${{ matrix.os }}
Expand Down
39 changes: 19 additions & 20 deletions .github/workflows/test_optimum_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name: Optimum common / 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 @@ -17,25 +17,24 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
os: [ubuntu-20.04, windows-2019, macos-13]

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: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[tests]
ls -l optimum/
- name: Test with unittest
shell: bash
run: |
# Setting HUGGINGFACE_CO_STAGING to true for only one job of the matrix as the staging tests cannot run in parallel.
export HUGGINGFACE_CO_STAGING=${{ matrix.python-version == '3.8' && matrix.os == 'ubuntu-20.04' }}
pytest tests/test_*.py
- 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: |
python -m pip install --upgrade pip
pip install .[tests]
ls -l optimum/
- name: Test with unittest
shell: bash
run: |
# Setting HUGGINGFACE_CO_STAGING to true for only one job of the matrix as the staging tests cannot run in parallel.
export HUGGINGFACE_CO_STAGING=${{ matrix.python-version == '3.8' && matrix.os == 'ubuntu-20.04' }}
pytest tests/test_*.py
Loading

0 comments on commit 6802a0c

Please sign in to comment.