Skip to content

[pre-commit.ci] pre-commit autoupdate #830

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #830

Workflow file for this run

# Copyright (c) 2020, yolort team. All rights reserved.
name: CI testing
on:
push:
branches:
- main
- release/*
pull_request:
branches:
- main
- release/*
jobs:
Unittest:
runs-on: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
image:
- ubuntu-latest
torch:
- PyTorch 1.9.1+cpu
- PyTorch 1.10.2+cpu
- PyTorch 1.11.0+cpu
- PyTorch 1.12.1+cpu
- PyTorch 1.13.1+cpu
include:
- torch: PyTorch 1.9.1+cpu
torch_address: torch==1.9.1+cpu torchvision==0.10.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
unittest_type: -v --cov=test --cov-report=xml
torchvision: release/0.10
- torch: PyTorch 1.10.2+cpu
torch_address: torch==1.10.2+cpu torchvision==0.11.3+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
unittest_type: -v --cov=test --cov-report=xml
torchvision: release/0.11
- torch: PyTorch 1.11.0+cpu
torch_address: torch==1.11.0+cpu torchvision==0.12.0+cpu --extra-index-url https://download.pytorch.org/whl/cpu
unittest_type: -v --cov=test --cov-report=xml
torchvision: release/0.12
- torch: PyTorch 1.12.1+cpu
torch_address: torch==1.12.1+cpu torchvision==0.13.1+cpu --extra-index-url https://download.pytorch.org/whl/cpu
unittest_type: -v --cov=test --cov-report=xml
torchvision: release/0.13
- torch: PyTorch 1.13.1+cpu
torch_address: torch==1.13.1+cpu torchvision==0.14.1+cpu --extra-index-url https://download.pytorch.org/whl/cpu
unittest_type: -v --cov=test --cov-report=xml
torchvision: release/0.14
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.5.0
with:
python-version: 3.8
- name: Upgrade pip
run: |
# install pip=>20.1 to use "pip cache dir"
python -m pip install --user --progress-bar off --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install ${{ matrix.torch }}
run: |
# requirements for PyTorch and torchvision
pip install --user --progress-bar off numpy pillow scipy
pip install --user --progress-bar off ${{ matrix.torch_address }}
- name: Install dependencies for developers
run: |
# requirements for unittest
pip install --user --progress-bar off flake8 pytest
pip install --user --progress-bar off pytest-cov
# Install other dependencies
pip install --user --progress-bar off opencv-python
pip install --user --progress-bar off pycocotools>=2.0.2
pip install --user --progress-bar off onnx
pip install --user --progress-bar off onnxruntime
pip install --user --progress-bar off requests
pip install --user onnx_graphsurgeon --index-url https://pypi.ngc.nvidia.com
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=18 --max-line-length=120 --statistics
- name: Install yolort
run: |
pip install -e .
- name: Test and Generate coverage report
run: |
PYTORCH_TEST_WITH_SLOW=1 pytest ${{ matrix.unittest_type }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
- name: Build LibTorchVision for ${{ matrix.torch }}
run: |
export TORCH_PATH=$(dirname $(python -c "import torch; print(torch.__file__)"))
cd ..
git clone https://github.com/pytorch/vision.git vision
cd vision
git checkout ${{ matrix.torchvision }}
mkdir build && cd build
cmake .. -DTorch_DIR=$TORCH_PATH/share/cmake/Torch
make -j4
sudo make install
- name: Export torchscript model
run: |
python test/tracing/trace_model.py
- name: Test libtorch tracing
run: |
export TORCH_PATH=$(dirname $(python -c "import torch; print(torch.__file__)"))
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TORCH_PATH/lib/
cd test/tracing
mkdir build && cd build
cmake .. -DTorch_DIR=$TORCH_PATH/share/cmake/Torch
make
mv ../yolov5s.torchscript.pt ./
echo ">> Test libtorch tracing"
./test_tracing