Add LSTM Conversion Notebook #195
Workflow file for this run
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: xmos-ai-tools-release-beta | |
on: | |
pull_request_target: | |
types: | |
- closed | |
branches: | |
- develop | |
env: | |
BAZEL_CACHE_URL: https://storage.googleapis.com/bazel_remote_cache_0/gh_actions | |
TOOLS_VERSION: 15.2.1 | |
TOOLS_LINK: https://www.xmos.ai/download/Tools-15---Linux-64(15_2_1).tgz | |
jobs: | |
build-release-archive: | |
name: Build release archive | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
ref: ${{ env.TAG_VERSION }} | |
- name: Build setup | |
shell: bash | |
run: | | |
sudo apt-get -y -qq install libncurses5 | |
cd $GITHUB_WORKSPACE/third_party/lib_tflite_micro | |
make patch | |
wget -nv "${{ env.TOOLS_LINK }}?key=${{ secrets.TOOLS_KEY }}" -O tools.tgz | |
tar xf tools.tgz | |
cd XMOS/XTC/${{ env.TOOLS_VERSION }} | |
source ./SetEnv | |
cd $GITHUB_WORKSPACE/third_party/lib_tflite_micro | |
mkdir -p build | |
cd build | |
cmake .. --toolchain=../lib_tflite_micro/submodules/xmos_cmake_toolchain/xs3a.cmake | |
make create_zip -j4 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: xcore-archive | |
path: third_party/lib_tflite_micro/build/*.zip | |
macos-release-wheel: | |
if: github.event.pull_request.merged == true | |
name: Build release wheels for macOS | |
needs: [build-release-archive] | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
python-version: [3.8] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: google-github-actions/auth@v1 | |
continue-on-error: true | |
with: | |
credentials_json: ${{ secrets.BAZEL_REMOTE_CACHE_JSON_KEY }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: xcore-archive | |
path: python/xmos_ai_tools/xinterpreters/device | |
- name: Prepare release archive | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE/python/xmos_ai_tools/xinterpreters/device | |
unzip release_archive.zip | |
rm release_archive.zip | |
- name: Build macOS wheels | |
shell: bash | |
run: | | |
python --version | |
python -m pip install wheel setuptools setuptools-scm numpy six --no-cache-dir | |
cd $GITHUB_WORKSPACE/third_party/lib_tflite_micro | |
make patch | |
cd $GITHUB_WORKSPACE | |
make build | |
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 --google_default_credentials' >> .bazelrc.user | |
fi | |
bazelisk build //:xcore-opt --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 | |
cd $GITHUB_WORKSPACE/python | |
python setup.py bdist_wheel --plat macosx_10_14_x86_64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ runner.os }}-wheels | |
path: python/wheelhouse | |
macos-arm-release-wheel: | |
if: github.event.pull_request.merged == true | |
name: Build release wheels for macOS arm64 | |
needs: [build-release-archive] | |
runs-on: macos-11 | |
strategy: | |
matrix: | |
python-version: [3.8] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: google-github-actions/auth@v1 | |
continue-on-error: true | |
with: | |
credentials_json: ${{ secrets.BAZEL_REMOTE_CACHE_JSON_KEY }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: xcore-archive | |
path: python/xmos_ai_tools/xinterpreters/device | |
- name: Prepare release archive | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE/python/xmos_ai_tools/xinterpreters/device | |
unzip release_archive.zip | |
rm release_archive.zip | |
- name: Build macOS arm wheels | |
env: | |
CMAKE_ENABLE_DARWIN_TARGET_ARM64: 1 | |
shell: bash | |
run: | | |
python --version | |
python -m pip install wheel setuptools setuptools-scm numpy six --no-cache-dir | |
cd $GITHUB_WORKSPACE/third_party/lib_tflite_micro | |
make patch | |
cd $GITHUB_WORKSPACE | |
make build | |
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 }}-arm64-python${{ matrix.python-version }}' >> .bazelrc.user | |
echo -e 'build --google_default_credentials' >> .bazelrc.user | |
fi | |
bazelisk build //:xcore-opt --cpu=darwin_arm64 --copt=-fvisibility=hidden --copt=-mmacosx-version-min=11.0 --linkopt=-mmacosx-version-min=11.0 --linkopt=-dead_strip --//:disable_version_check | |
cd $GITHUB_WORKSPACE/python | |
python setup.py bdist_wheel --plat-name macosx_11_0_arm64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ runner.os }}-arm-wheels | |
path: python/wheelhouse | |
manylinux-release-wheel: | |
if: github.event.pull_request.merged == true | |
name: Build release wheels for manylinux2014 | |
needs: [build-release-archive] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.8] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: google-github-actions/auth@v1 | |
continue-on-error: true | |
with: | |
credentials_json: ${{ secrets.BAZEL_REMOTE_CACHE_JSON_KEY }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: xcore-archive | |
path: python/xmos_ai_tools/xinterpreters/device | |
- name: Prepare release archive | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE/python/xmos_ai_tools/xinterpreters/device | |
unzip release_archive.zip | |
rm release_archive.zip | |
- name: Build manylinux2014 wheels | |
# 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 --google_default_credentials' >> .bazelrc.user | |
fi | |
popd | |
docker run \ | |
-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 --no-cache-dir | |
cd python | |
for f in dist/*.whl; do | |
auditwheel repair --plat manylinux2014_x86_64 $f | |
done | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ runner.os }}-wheels | |
# auditwheel creates the output wheel in the wheelhouse folder | |
path: python/wheelhouse | |
windows-release-wheel: | |
if: github.event.pull_request.merged == true | |
name: Build release wheels for windows | |
needs: [build-release-archive] | |
runs-on: windows-2019 | |
strategy: | |
matrix: | |
python-version: [3.8] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: google-github-actions/auth@v1 | |
continue-on-error: true | |
with: | |
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 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: xcore-archive | |
path: python/xmos_ai_tools/xinterpreters/device | |
- name: Prepare release archive | |
shell: cmd | |
run: | | |
cd %GITHUB_WORKSPACE%/python/xmos_ai_tools/xinterpreters/device | |
7z x release_archive.zip | |
del release_archive.zip | |
- name: Build xcore-opt and xtflm-interpreter | |
shell: cmd | |
run: | | |
python --version | |
python -m pip install wheel setuptools setuptools-scm numpy six --no-cache-dir | |
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/lib_tflite_micro/submodules/tflite-micro | |
patch -p0 < ../../../patches/tflite-micro.patch | |
cd %GITHUB_WORKSPACE%/python/xmos_ai_tools/xinterpreters/host | |
mkdir -p build | |
cd build | |
cmake .. | |
cmake --build . -t install --parallel --config Release | |
cd %GITHUB_WORKSPACE%/experimental/xformer | |
set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC | |
bazelisk build //:xcore-opt --local_ram_resources=5120 --action_env PYTHON_BIN_PATH="C:/hostedtoolcache/windows/Python/3.8.10/x64/python.exe" --remote_cache=${{ env.BAZEL_CACHE_URL }}/${{ runner.os }}-${{ runner.arch }}-python${{ matrix.python-version }} --google_default_credentials --//:disable_version_check | |
- name: Build windows wheels | |
shell: cmd | |
run: | | |
cd python | |
python setup.py bdist_wheel | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ runner.os }}-wheels | |
path: python/dist | |
publish-wheels: | |
if: github.event.pull_request.merged == true | |
name: Publish wheels to PyPi | |
needs: [macos-release-wheel, macos-arm-release-wheel, manylinux-release-wheel, windows-release-wheel] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: macOS-wheels | |
path: macOS-wheels | |
if: ${{ needs.macos-release-wheel.result == 'success' }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: macOS-arm-wheels | |
path: macOS-arm-wheels | |
if: ${{ needs.macos-arm-release-wheel.result == 'success' }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: Linux-wheels | |
path: Linux-wheels | |
if: ${{ needs.manylinux-release-wheel.result == 'success' }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: Windows-wheels | |
path: Windows-wheels | |
if: ${{ needs.windows-release-wheel.result == 'success' }} | |
- run: | | |
set -x | |
mkdir -p dist | |
cp macOS-wheels/*.whl dist/ || true | |
cp macOS-arm-wheels/*.whl dist/ || true | |
cp Linux-wheels/*.whl dist/ || true | |
cp Windows-wheels/*.whl dist/ || true | |
ls -la dist/ | |
sha256sum dist/*.whl | |
- name: Publish packages to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |