Skip to content

Add LSTM Conversion Notebook #340

Add LSTM Conversion Notebook

Add LSTM Conversion Notebook #340

Workflow file for this run

name: xmos-ai-tools-build-and-test
on:
workflow_dispatch:
inputs:
version:
description: "Provide a valid branch or commit hash"
required: true
pull_request:
# Save the tag version in an environment variable
# The pretend version is used for the wheel as the
# tag version might be a branch name or commit hash
env:
TAG_VERSION: ${{ github.event.inputs.version }}
PRETEND_VERSION: 0.1.1
BAZEL_CACHE_URL: https://storage.googleapis.com/bazel_remote_cache_0/gh_actions
jobs:
macos-release-wheel:
name: Build and test release wheels for macOS
runs-on: macos-latest
strategy:
matrix:
python-version: [3.8]
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
ref: ${{ env.TAG_VERSION }}
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- uses: google-github-actions/auth@v0
continue-on-error: true
with:
create_credentials_file: true
credentials_json: ${{ secrets.BAZEL_REMOTE_CACHE_JSON_KEY }}
- name: Build setup
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.PRETEND_VERSION }}
shell: bash
run: |
python --version
python -m pip install wheel setuptools setuptools-scm numpy six
cd $GITHUB_WORKSPACE/third_party/lib_tflite_micro
make patch
cd $GITHUB_WORKSPACE/python/xmos_ai_tools/xinterpreters/host
mkdir -p build
cd build
cmake ..
cmake --build . -t install --parallel --config Release
- name: Build xformer
shell: bash
run: |
cd $GITHUB_WORKSPACE/experimental/xformer
if [[ -n $GOOGLE_APPLICATION_CREDENTIALS ]]; then
echo "using Google Cloud Storage cache"
echo -e 'build --remote_cache=${{ env.BAZEL_CACHE_URL }}/${{ runner.os }}-${{ runner.arch }}-python${{ matrix.python-version }}' >> .bazelrc.user
echo -e 'build --remote_upload_local_results=true --experimental_remote_cache_compression' >> .bazelrc.user
echo -e 'build --google_default_credentials' >> .bazelrc.user
fi
bazelisk build //:xcore-opt --verbose_failures --copt=-fvisibility=hidden --copt=-mavx --copt=-mmacosx-version-min=10.13 --linkopt=-mmacosx-version-min=10.13 --linkopt=-dead_strip --distinct_host_configuration=false --//:disable_version_check
- name: Build macOS wheels
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.PRETEND_VERSION }}
shell: bash
run: |
cd $GITHUB_WORKSPACE/python
python setup.py bdist_wheel --plat macosx_10_9_x86_64
- name: Test macOS wheels
run: |
pip install -r ./requirements.txt
cd python/dist
pip install *
cd ../..
pytest integration_tests/runner.py --models_path integration_tests/models/non-bnns -n 3 --reruns 5 --reruns-delay 1
manylinux-release-wheel:
name: Build and test release wheels for manylinux2014
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
ref: ${{ env.TAG_VERSION }}
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- uses: google-github-actions/auth@v0
continue-on-error: true
with:
create_credentials_file: true
credentials_json: ${{ secrets.BAZEL_REMOTE_CACHE_JSON_KEY }}
- name: Build xformer and manylinux2014 wheel in docker
# The SETUPTOOLS_SCM_PRETEND_VERSION var is passed via docker to the
# python setup.py script to add the version info for the wheel file.
#
# auditwheel requires patchelf and repairs the created wheel file to
# be compatible for manylinux.
run: |
pushd $GITHUB_WORKSPACE/experimental/xformer
if [[ -n $GOOGLE_APPLICATION_CREDENTIALS ]]; then
echo "using Google Cloud Storage cache"
echo -e 'build --remote_cache=${{ env.BAZEL_CACHE_URL }}/${{ runner.os }}-${{ runner.arch }}-python${{ matrix.python-version }}' >> .bazelrc.user
echo -e 'build --remote_upload_local_results=true --experimental_remote_cache_compression' >> .bazelrc.user
echo -e 'build --google_default_credentials' >> .bazelrc.user
fi
popd
cd $GITHUB_WORKSPACE
docker run -e SETUPTOOLS_SCM_PRETEND_VERSION=${{ env.PRETEND_VERSION }} \
-e GOOGLE_APPLICATION_CREDENTIALS=/tmp/gcloud-credentials.json \
-v $GOOGLE_APPLICATION_CREDENTIALS:/tmp/gcloud-credentials.json:ro \
-v ${PWD}:/ai_tools -w /ai_tools \
tensorflow/build:2.10-python${{ matrix.python-version }} \
.github/scripts/build_linux_wheel.sh
sudo apt-get -y -qq install patchelf --no-install-recommends
python -m pip install auditwheel==5.2.0
cd python
for f in dist/*.whl; do
auditwheel repair --plat manylinux2014_x86_64 $f
done
- name: Test linux wheels
run: |
pip install -r ./requirements.txt
cd python/wheelhouse
pip install *
cd ../..
pytest integration_tests/runner.py --models_path integration_tests/models/non-bnns -n 2 --reruns 5 --reruns-delay 1
windows-release-wheel:
name: Build and test release wheels for windows
runs-on: windows-2019
strategy:
matrix:
python-version: [3.8]
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
ref: ${{ env.TAG_VERSION }}
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- uses: google-github-actions/auth@v0
continue-on-error: true
with:
create_credentials_file: true
credentials_json: ${{ secrets.BAZEL_REMOTE_CACHE_JSON_KEY }}
- name: Configure pagefile
uses: al-cheb/configure-pagefile-action@v1.2
with:
minimum-size: 10GB
maximum-size: 20GB
- name: Set up pagefile
shell: pwsh
run: |
(Get-CimInstance Win32_PageFileUsage).AllocatedBaseSize
- name: Build setup
shell: cmd
run: |
python --version
python -m pip install wheel setuptools setuptools-scm numpy six
python -c "import sys; print(sys.executable)"
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd %GITHUB_WORKSPACE%/third_party/lib_tflite_micro
make patch
cd %GITHUB_WORKSPACE%/python/xmos_ai_tools/xinterpreters/host
mkdir -p build
cd build
cmake ..
cmake --build . -t install --parallel --config Release
- name: Build xformer
shell: cmd
run: |
cd %GITHUB_WORKSPACE%/experimental/xformer
IF DEFINED GOOGLE_APPLICATION_CREDENTIALS set "BAZEL_EXTRA_ARGS=--remote_cache=${{ env.BAZEL_CACHE_URL }}/${{ runner.os }}-${{ runner.arch }}-python${{ matrix.python-version }} --google_default_credentials --remote_upload_local_results=true --experimental_remote_cache_compression"
set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC
bazelisk build //:xcore-opt --verbose_failures --local_ram_resources=5120 --action_env PYTHON_BIN_PATH="C:/hostedtoolcache/windows/Python/3.8.10/x64/python.exe" %BAZEL_EXTRA_ARGS% --//:disable_version_check
- name: Build windows wheels
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.PRETEND_VERSION }}
shell: cmd
run: |
cd python
python setup.py bdist_wheel
- name: Test windows wheels
run: |
pip install -r ./requirements.txt
cd python/dist
pip install xmos_ai_tools-0.1.1-py3-none-win_amd64.whl
cd ../..
pytest integration_tests/runner.py --models_path integration_tests/models/non-bnns -n 2 --reruns 5 --reruns-delay 1