add support for torch 2.0 and 2.1 #58
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run CI Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
# run-tf-tests: | |
# runs-on: ubuntu-latest | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# py_ver: ["3.8", "3.9", "3.10", "3.11"] | |
# tf_ver: ["2.10", "2.11", "2.12", "2.13", "2.14", "2.15"] | |
# exclude: | |
# - py_ver: "3.11" | |
# tf_ver: "2.10" | |
# - py_ver: "3.11" | |
# tf_ver: "2.11" | |
# - py_ver: "3.8" | |
# tf_ver: "2.14" | |
# - py_ver: "3.8" | |
# tf_ver: "2.15" | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# - name: Install Python 3 | |
# uses: actions/setup-python@v5 | |
# with: | |
# python-version: ${{matrix.py_ver}} | |
# - name: Install dependencies | |
# run: | | |
# pip install tensorflow==${{matrix.tf_ver}} | |
# pip install -r requirements_test.txt | |
# pip list | |
# - name: Run pytest | |
# run: | | |
# pytest sony_custom_layers/keras | |
run-torch-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
py_ver: [ "3.8", "3.9", "3.10", "3.11" ] | |
#torch_ver: ["2.0", "2.1", "2.2"] | |
#torchvision_ver: ["0.15", "0.16", "0.17"] | |
ort_ver: ["1.15", "1.16", "1.17"] | |
ort_ext_ver: ["0.8", "0.9", "0.10"] | |
onnx_ver: ["1.14", "1.15"] | |
t: ["foo"] | |
include: | |
# for each pair of torch, torchvision versions we sanity-test max versions and min versions of other deps | |
# + one case for intermediate versions | |
- t: "foo" | |
torch_ver: "2.2" | |
torchvision_ver: "0.17" # requires torch 2.2 | |
ort_ver: "1.17" | |
ort_ext_ver: "0.10" | |
onnx_ver: "1.15" | |
# - t: "foo" | |
# torch_ver: "2.2" | |
# torchvision_ver: "0.17" | |
# ort_ver: "1.15" | |
# ort_ext_ver: "0.8" | |
# onnx_ver: "1.14" | |
# - torch_ver: "2.2" | |
# torchvision_ver: "0.17" | |
# ort_ver: "1.16" | |
# ort_ext_ver: "0.9" | |
# onnx_ver: "1.14" | |
- t: "foo" | |
torch_ver: "2.1" | |
torchvision_ver: "0.16" # requires torch 2.1 | |
ort_ver: "1.17" | |
ort_ext_ver: "0.10" | |
onnx_ver: "1.15" | |
# - torch_ver: "2.1" | |
# torchvision_ver: "0.16" | |
# ort_ver: "1.15" | |
# ort_ext_ver: "0.8" | |
# onnx_ver: "1.14" | |
# - torch_ver: "2.0" | |
# torchvision_ver: "0.15" # requires torch 2.0 | |
# ort_ver: "1.17" | |
# ort_ext_ver: "0.10" | |
# onnx_ver: "1.15" | |
# - torch_ver: "2.0" | |
# torchvision_ver: "0.15" | |
# ort_ver: "1.15" | |
# ort_ext_ver: "0.8" | |
# onnx_ver: "1.14" | |
exclude: | |
- py_ver: "3.11" | |
ort_ext_ver: "0.8.*" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{matrix.py_ver}} | |
- name: Install dependencies | |
run: | | |
pip install torch==${{matrix.torch_ver}} \ | |
torchvision==${{matrix.torchvision_ver}} \ | |
onnxruntime==${{matrix.ort_ver}} \ | |
onnxruntime_extensions==${{matrix.ort_ext_ver}} \ | |
onnx==${{matrix.onnx_ver}} \ | |
--index-url https://download.pytorch.org/whl/cpu \ | |
--extra-index-url https://pypi.org/simple | |
pip install -r requirements_test.txt | |
pip list | |
- name: Run pytest | |
run: | | |
pytest sony_custom_layers/pytorch | |
# build: | |
# # needs: [run-tf-tests, run-torch-tests] | |
# needs: [run-tf-tests, run-torch-tests] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# - name: Install Python 3 | |
# uses: actions/setup-python@v5 | |
# with: | |
# python-version: "3.10" | |
# - name: Run pre-commit | |
# run: | | |
# ./install-pre-commit.sh | |
# pre-commit run --all | |
# - name: get new dev tag | |
# shell: bash | |
# run : | | |
# pip install packaging | |
# git fetch --tags | |
# latest_tag=$(git tag -l | sort -V -r | head -n 1) | |
# if [ -z "$latest_tag" ]; then | |
# new_version=0.0.0.dev0 | |
# else | |
# latest_tag_without_v=${latest_tag#v} | |
# new_version=$(python -c " | |
# from packaging.version import parse | |
# v = parse('$latest_tag_without_v') | |
# if v.is_devrelease: | |
# print(f'{v.major}.{v.minor}.{v.micro}.dev{v.dev + 1}') | |
# else: | |
# print(f'{v.major}.{v.minor}.{v.micro + 1}.dev0') | |
# ") | |
# fi | |
# echo "new_ver=${new_version}" >> $GITHUB_ENV | |
# echo "new_tag=v${new_version}" >> $GITHUB_ENV | |
# echo "cat GITHUB_ENV" | |
# cat $GITHUB_ENV | |
# - name: update name and version to dev | |
# shell: bash | |
# run: | | |
# echo "__version__ = '${{ env.new_ver }}'" > sony_custom_layers/version.py | |
# echo "print sony_custom_layers/version.py" | |
# cat sony_custom_layers/version.py | |
# sed -i 's/name = sony-custom-layers/name = sony-custom-layers-dev/' setup.cfg | |
# echo "print setup.cfg" | |
# cat setup.cfg | |
# - name: Build wheel | |
# run: | | |
# pip install build | |
# python -m build --wheel | |
# - name: Publish package pypi | |
# shell: bash | |
# run: | | |
# pip install twine | |
# echo "event_name is ${{ github.event_name }}" | |
# if [[ "${{ github.event_name }}" == "push" ]]; then | |
# twine upload --repository pypi dist/* -u __token__ -p ${{ secrets.PYPI_API_KEY }} | |
# git tag ${{ env.new_tag }} | |
# git push origin ${{ env.new_tag }} | |
# fi | |