Skip to content

5.1.0 Update. Avoid build collisions in the lemonade cache. Improve memory tracking and OGA testing. #692

5.1.0 Update. Avoid build collisions in the lemonade cache. Improve memory tracking and OGA testing.

5.1.0 Update. Avoid build collisions in the lemonade cache. Improve memory tracking and OGA testing. #692

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Lint and Test TurnkeyML
on:
push:
branches: ["main", "canary", "refresh"]
pull_request:
branches: ["main", "canary", "refresh"]
paths:
- src/turnkeyml/**
- test/turnkey/**
- examples/turnkey/**
- .github/workflows/test_turnkey.yml
permissions:
contents: read
jobs:
build-turnkey:
env:
TURNKEY_TRACEBACK: True
strategy:
matrix:
python-version: ["3.8", "3.11"]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Miniconda with 64-bit Python
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
activate-environment: tkml
python-version: ${{ matrix.python-version }}
- name: Install dependencies
shell: bash -el {0}
run: |
python -m pip install --upgrade pip
conda install pylint=3.2.7
pip install pytest
pip install -e plugins/devices
pip install -e . # Required to test current tkml package instead of pypi version
# tokenizers 0.20.4 seems to have an install bug, which we must avoid by limiting
# the transformers version
pip install "transformers<4.46.3" "tokenizers<0.20.4" timm
python -m pip check
- name: Lint with PyLint
shell: bash -el {0}
run: |
pylint src/turnkeyml --rcfile .pylintrc --ignore-paths src/turnkeyml/llm --jobs=1
pylint examples --rcfile .pylintrc --disable E0401,E0611 --jobs=1
- name: Test with unittest
shell: bash -el {0}
run: |
# Unit tests
python test/turnkey/unit.py
# turnkey examples
# Note: we clear the default cache location prior to each block of example runs
rm -rf ~/.cache/turnkey
python examples/turnkey/api/onnx_opset.py --onnx-opset 15
python examples/turnkey/api/loading_a_build.py
rm -rf ~/.cache/turnkey
turnkey -i examples/turnkey/cli/scripts/hello_world.py discover export-pytorch benchmark
rm -rf ~/.cache/turnkey
turnkey -i examples/turnkey/cli/scripts/multiple_invocations.py discover export-pytorch benchmark
rm -rf ~/.cache/turnkey
turnkey -i examples/turnkey/cli/scripts/max_depth.py discover --max-depth 1 export-pytorch benchmark
rm -rf ~/.cache/turnkey
turnkey -i examples/turnkey/cli/scripts/two_models.py discover export-pytorch benchmark
rm -rf ~/.cache/turnkey
turnkey -i examples/turnkey/cli/onnx/hello_world.onnx load-onnx benchmark
# E2E tests
cd test/turnkey
python cli.py
python analysis.py
- name: Test example plugins
shell: bash -el {0}
run: |
rm -rf ~/.cache/turnkey
pip install -e examples/turnkey/cli/plugins/example_tool
turnkey -i examples/turnkey/cli/scripts/hello_world.py discover export-pytorch example-plugin-tool benchmark