add benchmark results for checkpoints in guide #183
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: Tests | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
python: 3.7 | |
torch: 1.9.0+cpu | |
torchvision: 0.10.0+cpu | |
torch-source: https://download.pytorch.org/whl/torch_stable.html | |
onnx: True | |
- os: ubuntu-latest | |
python: 3.9 | |
torch: 1.13.1+cpu | |
torchvision: 0.14.1+cpu | |
torch-source: https://download.pytorch.org/whl/torch_stable.html | |
slow: True | |
conda: True | |
- os: ubuntu-latest | |
python: '3.10' | |
torch: 2.2.1+cpu | |
torchvision: 0.17.1+cpu | |
torch-source: https://download.pytorch.org/whl/torch_stable.html | |
build-isolation: True | |
- os: macos-latest | |
python: 3.7 | |
torch: 1.9.0 | |
torchvision: 0.10.0 | |
torch-source: https://download.pytorch.org/whl/torch_stable.html | |
onnx: True | |
- os: macos-latest | |
python: 3.9 | |
torch: 1.13.1 | |
torchvision: 0.14.1 | |
torch-source: https://download.pytorch.org/whl/torch_stable.html | |
slow: True | |
conda: True | |
- os: macos-latest | |
python: '3.10' | |
torch: 2.2.1 | |
torchvision: 0.17.1 | |
torch-source: https://download.pytorch.org/whl/torch_stable.html | |
build-isolation: True | |
- os: windows-latest | |
python: 3.9 | |
torch: 1.13.1+cpu | |
torchvision: 0.14.1+cpu | |
torch-source: https://download.pytorch.org/whl/torch_stable.html | |
slow: True | |
env: | |
DEBUG: 1 | |
# DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer | |
steps: | |
- run: ls -n /Applications/ | grep Xcode* | |
if: matrix.os == 'macos-latest' | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache checkpoints and data | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache | |
data-cifar10 | |
key: ${{ runner.os }}-${{ hashFiles('setup.py') }} | |
- name: Set up Python ${{ matrix.python }} | |
if: ${{ !matrix.conda }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Set up Conda | |
if: matrix.conda | |
uses: s-weigand/setup-conda@v1 | |
with: | |
update-conda: true | |
python-version: ${{ matrix.python }} | |
conda-channels: anaconda, conda-forge | |
- run: conda --version | |
if: matrix.conda | |
- run: which python | |
if: matrix.conda | |
- run: python --version | |
- name: Install pre-requisites | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install torch==${{ matrix.torch }} torchvision==${{ matrix.torchvision }} -f ${{ matrix.torch-source }} | |
- name: Install | |
run: | | |
echo ${DEBUG} | |
python -m pip install -e ".[test]" --no-build-isolation | |
- name: Install ONNX dependencies | |
if: matrix.onnx | |
run: python -m pip install -e ".[onnx]" --no-build-isolation | |
- name: Install for training | |
if: matrix.slow | |
run: | | |
python -m pip install cython --no-build-isolation | |
python -m pip install -e ".[train]" --no-build-isolation | |
- name: Install ffmpeg for Guide test | |
uses: FedericoCarboni/setup-ffmpeg@v3 | |
if: matrix.slow | |
id: setup-ffmpeg | |
- name: ffmpeg codecs | |
if: matrix.slow | |
run: ffmpeg -codecs | |
- name: Install for MacOSX - CoreML | |
if: matrix.os == 'macos-latest' | |
run: python -m pip install -e ".[coreml]" --no-build-isolation | |
- name: Install OpenCV | |
if: matrix.slow && matrix.os == 'ubuntu-latest' | |
run: sudo apt-get update && sudo apt-get --no-install-recommends install python3-opencv libopencv-dev | |
- name: Download libtorch binaries compiled with CXX11-ABI=1 | |
if: matrix.slow && matrix.os == 'ubuntu-latest' | |
run: | | |
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.13.1%2Bcpu.zip | |
unzip libtorch-cxx11-abi-shared-with-deps-1.13.1+cpu.zip | |
ls | |
ls libtorch | |
ls libtorch/lib | |
- name: Print environment | |
run: | | |
python -m pip freeze | |
python --version | |
python -c "import openpifpaf; print(openpifpaf.__version__)" | |
- name: Lint openpifpaf | |
run: | | |
pylint openpifpaf --disable=fixme | |
- name: Lint tests | |
if: matrix.os != 'windows-latest' # because of path separator | |
run: | | |
pylint tests/*.py --disable=fixme | |
- name: pycodestyle openpifpaf | |
if: matrix.os != 'windows-latest' # because of path separator | |
run: | | |
python -m pycodestyle src/openpifpaf | |
- name: pycodestyle tests | |
if: matrix.os != 'windows-latest' # because of path separator | |
run: | | |
python -m pycodestyle tests/*.py | |
- name: Lint C++ | |
if: matrix.os != 'windows-latest' # because of path separator | |
run: cpplint --recursive --exclude=src/openpifpaf/csrc/build --linelength=120 --filter=-legal,-whitespace/parens,-whitespace/braces,-whitespace/semicolon,-readability/todo src/openpifpaf/csrc | |
- name: Check notebook formats and tags | |
if: matrix.slow && matrix.os == 'ubuntu-latest' | |
run: | | |
cd guide | |
python nb_cell_tags.py # runs all notebooks through nbformat | |
git status | |
git diff | |
git diff-index --quiet HEAD # exit code 1 when files were changed | |
- name: Check that notebook outputs are stripped | |
if: matrix.slow && matrix.os == 'ubuntu-latest' | |
run: | | |
cd guide | |
nbstripout *.ipynb | |
git status | |
git diff | |
git diff-index --quiet HEAD # exit code 1 when files were changed | |
- name: Lint and pycodestyle on notebooks | |
if: matrix.slow && matrix.os == 'ubuntu-latest' | |
run: | | |
mkdir guide_py | |
jupyter nbconvert --to=script --output-dir=./guide_py ./guide/*.ipynb | |
pylint ./guide_py/*.py --disable=trailing-whitespace,trailing-newlines,line-too-long,pointless-statement,undefined-variable,expression-not-assigned,wrong-import-position,ungrouped-imports,wrong-import-order,invalid-name | |
pycodestyle guide_py/*.py --ignore=W291,W391,E302,E305,E402,E501 | |
- name: Test training | |
if: matrix.slow | |
env: | |
PYTHONDEVMODE: 1 | |
run: | | |
pytest -vv -s -m slow | |
- name: Test | |
env: | |
PYTHONDEVMODE: 1 | |
run: | | |
pytest -vv -m "not slow" | |
- name: Test guide (download data) | |
if: matrix.slow && matrix.os == 'ubuntu-latest' | |
run: | | |
cd guide && python download_data.py && cd .. | |
- name: Test guide | |
if: matrix.slow && matrix.os == 'ubuntu-latest' | |
run: | | |
cd guide && pytest --nbval-lax --current-env *.ipynb && cd .. | |
- name: generate sdist | |
run: python setup.py sdist | |
- name: sdist installable without build isolation | |
if: matrix.os != 'windows-latest' # because of path separator | |
run: | | |
mkdir sdist_test_dir | |
cd sdist_test_dir | |
python -m pip uninstall -y openpifpaf-vita | |
python -m pip install --no-build-isolation ../dist/openpifpaf-vita* | |
python -c "import openpifpaf" | |
- name: sdist installable with build isolation | |
if: matrix.build-isolation && matrix.os != 'windows-latest' # because of path separator | |
run: | | |
mkdir sdist_with_build_isolation_test_dir | |
cd sdist_with_build_isolation_test_dir | |
python -m pip uninstall -y openpifpaf-vita | |
python -m pip install ../dist/openpifpaf-vita* | |
python -c "import openpifpaf" |