Skip to content

Commit

Permalink
Merge fork from cleanup (#1)
Browse files Browse the repository at this point in the history
* Bring up the tkml tests

* Revamp the tkml readme

* Create LICENSE

* Fix all names, links, and paths (#4)

---------

Signed-off-by: Jeremy Fowers <[email protected]>
Co-authored-by: Jeremy Fowers <[email protected]>
Co-authored-by: Jeremy Fowers <[email protected]>
Co-authored-by: Victoria Godsoe <[email protected]>
  • Loading branch information
4 people authored Dec 1, 2023
1 parent 524e4c3 commit f82acab
Show file tree
Hide file tree
Showing 32 changed files with 681 additions and 356 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
name: Publish Python distributions to PyPI

on:
push:
Expand All @@ -10,7 +10,7 @@ on:

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
name: Build and publish Python distributions to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
Expand All @@ -24,11 +24,16 @@ jobs:
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: >-
python -m build --sdist --wheel --outdir dist/ toolchain
python -m build --sdist --wheel --outdir dist/ .
- name: Test wheel
shell: bash -el {0}
run: |
python -m pip install --upgrade pip
pip install dist/*.whl
models=$(turnkey models location --quiet)
turnkey $models/selftest/linear.py
- name: Publish distribution package to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
80 changes: 0 additions & 80 deletions .github/workflows/test_azure.yml

This file was deleted.

34 changes: 17 additions & 17 deletions .github/workflows/test_build_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,46 +36,46 @@ jobs:
run: |
python -m pip install --upgrade pip
conda install pylint
pip install -e toolchain[tensorflow] --no-cache-dir
pip install -e .[tensorflow] --no-cache-dir
pip install transformers
python -m pip check
- name: Lint with PyLint
shell: bash -el {0}
run: |
pylint toolchain/src/turnkeyml/build --rcfile toolchain/.pylintrc
pylint toolchain/examples/build_api --rcfile toolchain/.pylintrc
pylint src/turnkeyml/build --rcfile .pylintrc
pylint examples/build_api --rcfile .pylintrc
- name: Test with unittest
shell: bash -el {0}
run: |
# build api examples
# Note: we clear the default cache location prior to each example run
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/hello_torch_world.py
python examples/build_api/hello_torch_world.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/hello_keras_world.py
python examples/build_api/hello_keras_world.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/hello_onnx_world.py
python examples/build_api/hello_onnx_world.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/randomforest.py
python examples/build_api/randomforest.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/xgbclassifier.py
python examples/build_api/xgbclassifier.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/lgbmclassifier.py
python examples/build_api/lgbmclassifier.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/kneighborsclassifier.py
python examples/build_api/kneighborsclassifier.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/build_name.py
python examples/build_api/build_name.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/cache_dir.py
python examples/build_api/cache_dir.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/no_monitor.py
python examples/build_api/no_monitor.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/rebuild_always.py
python examples/build_api/rebuild_always.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/rebuild_never.py
python examples/build_api/rebuild_never.py
rm -rf ~/.cache/turnkey_test_cache
python toolchain/examples/build_api/sequence.py
python examples/build_api/sequence.py
# build api tests
python toolchain/test/build_model.py
python test/build_model.py
4 changes: 2 additions & 2 deletions .github/workflows/test_gpu_turnkey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ jobs:
run: |
python -m pip install --upgrade pip
conda install pylint
pip install -e toolchain
pip install -e .
pip install transformers
python -m pip check
- name: Test with unittest
shell: bash -el {0}
run: |
# E2E tests
python toolchain/test/gpu.py
python test/gpu.py
deallocate_vm:
needs: build_and_test
if: always()
Expand Down
81 changes: 42 additions & 39 deletions .github/workflows/test_turnkey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,97 +36,100 @@ jobs:
python -m pip install --upgrade pip
conda install pylint
pip install pytest
pip install -e toolchain
pip install -e .
pip install transformers timm
python -m pip check
- name: Lint with PyLint
shell: bash -el {0}
run: |
pylint toolchain/src/turnkeyml --rcfile toolchain/.pylintrc
pylint toolchain/examples --rcfile toolchain/.pylintrc --ignore-paths toolchain/examples/build_api --disable E0401,E0611
pylint src/turnkeyml --rcfile .pylintrc
pylint examples --rcfile .pylintrc --ignore-paths examples/build_api --disable E0401,E0611
- name: Test with unittest
shell: bash -el {0}
run: |
# Unit tests
python toolchain/test/unit.py
python test/unit.py
# turnkey examples
# Note: we clear the default cache location prior to each example run
rm -rf ~/.cache/turnkey
python toolchain/examples/model_api/hello_world.py
python examples/model_api/hello_world.py
rm -rf ~/.cache/turnkey
python toolchain/examples/files_api/onnx_opset.py --onnx-opset 15
python examples/files_api/onnx_opset.py --onnx-opset 15
rm -rf ~/.cache/turnkey
turnkey toolchain/examples/cli/scripts/hello_world.py
turnkey examples/cli/scripts/hello_world.py
rm -rf ~/.cache/turnkey
turnkey toolchain/examples/cli/scripts/multiple_invocations.py
turnkey examples/cli/scripts/multiple_invocations.py
rm -rf ~/.cache/turnkey
turnkey toolchain/examples/cli/scripts/max_depth.py --max-depth 1
turnkey examples/cli/scripts/max_depth.py --max-depth 1
rm -rf ~/.cache/turnkey
turnkey toolchain/examples/cli/scripts/two_models.py
turnkey examples/cli/scripts/two_models.py
rm -rf ~/.cache/turnkey
turnkey toolchain/examples/cli/onnx/sample.onnx
# TODO: sample.onnx test is commented because it throws an error in CI
# turnkey examples/cli/onnx/sample.onnx
# E2E tests
cd toolchain/test/
cd test/
python cli.py
python analysis.py
python model_api.py
- name: Test example plugins
shell: bash -el {0}
run: |
rm -rf ~/.cache/turnkey
pip install -e toolchain/examples/cli/plugins/example_rt
turnkey toolchain/examples/cli/scripts/hello_world.py --runtime example-rt
pip install -e examples/cli/plugins/example_rt
turnkey examples/cli/scripts/hello_world.py --runtime example-rt
rm -rf ~/.cache/turnkey
pip install -e toolchain/examples/cli/plugins/example_seq
turnkey toolchain/examples/cli/scripts/hello_world.py --sequence example-seq
pip install -e examples/cli/plugins/example_seq
turnkey examples/cli/scripts/hello_world.py --sequence example-seq
rm -rf ~/.cache/turnkey
pip install -e toolchain/examples/cli/plugins/example_combined
turnkey toolchain/examples/cli/scripts/hello_world.py --runtime example-combined-rt --rt-args delay_before_benchmarking::5
turnkey toolchain/examples/cli/scripts/hello_world.py --device example_family::part1::config2
turnkey toolchain/examples/cli/scripts/hello_world.py --device example_family::part1::config1
turnkey toolchain/examples/cli/scripts/hello_world.py --device example_family::part1
turnkey toolchain/examples/cli/scripts/hello_world.py --device example_family
pip install -e examples/cli/plugins/example_combined
turnkey examples/cli/scripts/hello_world.py --runtime example-combined-rt --rt-args delay_before_benchmarking::5
turnkey examples/cli/scripts/hello_world.py --device example_family::part1::config2
turnkey examples/cli/scripts/hello_world.py --device example_family::part1::config1
turnkey examples/cli/scripts/hello_world.py --device example_family::part1
turnkey examples/cli/scripts/hello_world.py --device example_family
# E2E tests
cd toolchain/test
cd test
python plugins.py
- name: Install and Start Slurm
if: runner.os != 'Windows'
shell: bash -el {0}
run: |
sudo apt update -y
sudo apt install slurm-wlm -y
cp toolchain/test/helpers/slurm.conf toolchain/test/helpers/slurm_modified.conf
sed -i "s/YOUR_HOSTNAME_HERE/$HOSTNAME/" toolchain/test/helpers/slurm_modified.conf
sudo mv toolchain/test/helpers/slurm_modified.conf /etc/slurm/slurm.conf
cp test/helpers/slurm.conf test/helpers/slurm_modified.conf
sed -i "s/YOUR_HOSTNAME_HERE/$HOSTNAME/" test/helpers/slurm_modified.conf
sudo mv test/helpers/slurm_modified.conf /etc/slurm/slurm.conf
sudo service slurmd start
sudo service slurmctld start
sudo service munge start
- name: Test turnkey on Slurm
if: runner.os != 'Windows'
shell: bash -el {0}
run: |
# Create conda environment for Slurm using srun (sbatch + wait)
export SKIP_REQUIREMENTS_INSTALL="True"
export TORCH_CPU="True"
srun toolchain/src/turnkeyml/cli/setup_venv.sh
# TODO: Slurm test is commented out because it isn't working in OMZ CI
# @Daniel to fix and un-comment
# - name: Test turnkey on Slurm
# if: runner.os != 'Windows'
# shell: bash -el {0}
# run: |
# # Create conda environment for Slurm using srun (sbatch + wait)
# export SKIP_REQUIREMENTS_INSTALL="True"
# export TORCH_CPU="True"
# srun src/turnkeyml/cli/setup_venv.sh

# Run tests on Slurm
export TURNKEY_SLURM_USE_DEFAULT_MEMORY="True"
turnkey benchmark toolchain/models/selftest/linear.py --build-only --use-slurm --cache-dir local_cache
bash toolchain/test/helpers/check_slurm_output.sh slurm-2.out
# # Run tests on Slurm
# export TURNKEY_SLURM_USE_DEFAULT_MEMORY="True"
# turnkey benchmark models/selftest/linear.py --build-only --use-slurm --cache-dir local_cache
# bash test/helpers/check_slurm_output.sh slurm-2.out

# Below tests are commented out as the GitHub runner runs out of space installing the requirements
# - name: Check installation of requirements.txt and their compatibility with turnkey
# shell: bash -el {0}
# run: |
# conda create --name test-requirements python=3.8
# conda activate test-requirements
# pip install -r toolchain/models/requirements.txt
# pip install -r models/requirements.txt
# python -m pip check
# python -c "import torch_geometric"
# conda deactivate
Loading

0 comments on commit f82acab

Please sign in to comment.