Fix #3586: NumPy versions
This commit is contained in:
parent
ef31be2e32
commit
c4a4ca2bf8
14
.github/actions/numpy_vers/README.md
vendored
Normal file
14
.github/actions/numpy_vers/README.md
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
GitHub Action to set NumPy versions
|
||||||
|
===================================
|
||||||
|
|
||||||
|
This actions aims at computing correct values for NumPy dependencies:
|
||||||
|
- `NUMPY_BUILD_VERSION`: range of accepted versions at Python binding build time
|
||||||
|
- `NUMPY_DEP_VERSION`: range of accepted versions for execution time
|
||||||
|
|
||||||
|
Versions are set considering several factors:
|
||||||
|
- API and ABI compatibility ; otherwise we can have the binding wrapper
|
||||||
|
throwing errors like "Illegal instruction", or computing wrong values
|
||||||
|
because of changed memory layout
|
||||||
|
- Wheels availability: for CI and end users, we want to avoid having to
|
||||||
|
rebuild numpy so we stick to versions where there is an existing upstream
|
||||||
|
`wheel` file
|
93
.github/actions/numpy_vers/action.yml
vendored
Normal file
93
.github/actions/numpy_vers/action.yml
vendored
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
name: "get numpy versions"
|
||||||
|
description: "Get proper NumPy build and runtime versions dependencies range"
|
||||||
|
inputs:
|
||||||
|
pyver:
|
||||||
|
description: "Python version"
|
||||||
|
required: true
|
||||||
|
outputs:
|
||||||
|
build_version:
|
||||||
|
description: "NumPy build dependency"
|
||||||
|
value: ${{ steps.numpy.outputs.build }}
|
||||||
|
dep_version:
|
||||||
|
description: "NumPy runtime dependency"
|
||||||
|
value: ${{ steps.numpy.outputs.dep }}
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- id: numpy
|
||||||
|
run: |
|
||||||
|
NUMPY_BUILD_VERSION="==1.7.0"
|
||||||
|
NUMPY_DEP_VERSION=">=1.7.0"
|
||||||
|
|
||||||
|
OS=$(uname -s)
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
|
||||||
|
case "${OS}:${ARCH}" in
|
||||||
|
Linux:x86_64)
|
||||||
|
case "${{ inputs.pyver }}" in
|
||||||
|
3.7*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.14.5"
|
||||||
|
NUMPY_DEP_VERSION=">=1.14.5"
|
||||||
|
;;
|
||||||
|
3.8*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.17.3"
|
||||||
|
NUMPY_DEP_VERSION=">=1.17.3"
|
||||||
|
;;
|
||||||
|
3.9*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.19.4"
|
||||||
|
NUMPY_DEP_VERSION=">=1.19.4"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
|
Darwin:*)
|
||||||
|
case "${{ inputs.pyver }}" in
|
||||||
|
3.6*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.9.0"
|
||||||
|
NUMPY_DEP_VERSION=">=1.9.0"
|
||||||
|
;;
|
||||||
|
3.7*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.14.5"
|
||||||
|
NUMPY_DEP_VERSION=">=1.14.5,<=1.17.0"
|
||||||
|
;;
|
||||||
|
3.8*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.17.3"
|
||||||
|
NUMPY_DEP_VERSION=">=1.17.3,<=1.17.3"
|
||||||
|
;;
|
||||||
|
3.9*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.19.4"
|
||||||
|
NUMPY_DEP_VERSION=">=1.19.4"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
|
# TODO: 'Windows*' might not be good
|
||||||
|
Windows*:x86_64)
|
||||||
|
case "${{ inputs.pyver }}" in
|
||||||
|
3.5*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.11.0"
|
||||||
|
NUMPY_DEP_VERSION=">=1.11.0,<1.12.0"
|
||||||
|
;;
|
||||||
|
3.6*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.12.0"
|
||||||
|
NUMPY_DEP_VERSION=">=1.12.0,<1.14.5"
|
||||||
|
;;
|
||||||
|
3.7*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.14.5"
|
||||||
|
NUMPY_DEP_VERSION=">=1.14.5,<=1.17.0"
|
||||||
|
;;
|
||||||
|
3.8*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.17.3"
|
||||||
|
NUMPY_DEP_VERSION=">=1.17.3,<=1.17.3"
|
||||||
|
;;
|
||||||
|
3.9*)
|
||||||
|
NUMPY_BUILD_VERSION="==1.19.4"
|
||||||
|
NUMPY_DEP_VERSION=">=1.19.4"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "::set-output name=build::${NUMPY_BUILD_VERSION}"
|
||||||
|
echo "::set-output name=dep::${NUMPY_DEP_VERSION}"
|
||||||
|
shell: bash
|
8
.github/actions/python-build/action.yml
vendored
8
.github/actions/python-build/action.yml
vendored
@ -4,6 +4,12 @@ inputs:
|
|||||||
build_flavor:
|
build_flavor:
|
||||||
description: "Python package name"
|
description: "Python package name"
|
||||||
required: true
|
required: true
|
||||||
|
numpy_build:
|
||||||
|
description: "NumPy build dependecy"
|
||||||
|
required: true
|
||||||
|
numpy_dep:
|
||||||
|
description: "NumPy runtime dependecy"
|
||||||
|
required: true
|
||||||
local_cflags:
|
local_cflags:
|
||||||
description: "CFLAGS for Python package"
|
description: "CFLAGS for Python package"
|
||||||
required: false
|
required: false
|
||||||
@ -32,6 +38,8 @@ runs:
|
|||||||
PROJECT_NAME="deepspeech-tflite"
|
PROJECT_NAME="deepspeech-tflite"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
NUMPY_BUILD_VERSION="${{ inputs.numpy_build }}" \
|
||||||
|
NUMPY_DEP_VERSION="${{ inputs.numpy_dep }}" \
|
||||||
EXTRA_CFLAGS=${{ inputs.local_cflags }} \
|
EXTRA_CFLAGS=${{ inputs.local_cflags }} \
|
||||||
EXTRA_LDFLAGS=${{ inputs.local_ldflags }} \
|
EXTRA_LDFLAGS=${{ inputs.local_ldflags }} \
|
||||||
EXTRA_LIBS=${{ inputs.local_libs }} \
|
EXTRA_LIBS=${{ inputs.local_libs }} \
|
||||||
|
17
.github/workflows/macOS-amd64.yml
vendored
17
.github/workflows/macOS-amd64.yml
vendored
@ -55,6 +55,9 @@ jobs:
|
|||||||
name: "Build CTC decoder Python package for testing"
|
name: "Build CTC decoder Python package for testing"
|
||||||
needs: [ swig_macOS ]
|
needs: [ swig_macOS ]
|
||||||
runs-on: macos-10.15
|
runs-on: macos-10.15
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [3.6.8]
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@ -62,7 +65,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: ./.github/actions/install-python-upstream
|
- uses: ./.github/actions/install-python-upstream
|
||||||
with:
|
with:
|
||||||
version: 3.6.8
|
version: ${{ matrix.python-version }}
|
||||||
- run: |
|
- run: |
|
||||||
python --version
|
python --version
|
||||||
pip --version
|
pip --version
|
||||||
@ -74,7 +77,13 @@ jobs:
|
|||||||
ls -hal ${{ github.workspace }}/native_client/ds-swig/bin
|
ls -hal ${{ github.workspace }}/native_client/ds-swig/bin
|
||||||
ln -s ds-swig ${{ github.workspace }}/native_client/ds-swig/bin/swig
|
ln -s ds-swig ${{ github.workspace }}/native_client/ds-swig/bin/swig
|
||||||
chmod +x ${{ github.workspace }}/native_client/ds-swig/bin/ds-swig ${{ github.workspace }}/native_client/ds-swig/bin/swig
|
chmod +x ${{ github.workspace }}/native_client/ds-swig/bin/ds-swig ${{ github.workspace }}/native_client/ds-swig/bin/swig
|
||||||
|
- id: get_numpy
|
||||||
|
uses: ./.github/actions/numpy_vers
|
||||||
|
with:
|
||||||
|
pyver: ${{ matrix.python-version }}
|
||||||
- run: |
|
- run: |
|
||||||
|
NUMPY_BUILD_VERSION=${{ steps.get_numpy.outputs.build_version }} \
|
||||||
|
NUMPY_DEP_VERSION=${{ steps.get_numpy.outputs.dep_version }} \
|
||||||
make -C native_client/ctcdecode/ \
|
make -C native_client/ctcdecode/ \
|
||||||
NUM_PROCESSES=$(sysctl hw.ncpu |cut -d' ' -f2) \
|
NUM_PROCESSES=$(sysctl hw.ncpu |cut -d' ' -f2) \
|
||||||
bindings
|
bindings
|
||||||
@ -276,9 +285,15 @@ jobs:
|
|||||||
#- uses: actions/setup-python@v2
|
#- uses: actions/setup-python@v2
|
||||||
# with:
|
# with:
|
||||||
# python-version: ${{ matrix.python-version }}
|
# python-version: ${{ matrix.python-version }}
|
||||||
|
- id: get_numpy
|
||||||
|
uses: ./.github/actions/numpy_vers
|
||||||
|
with:
|
||||||
|
pyver: ${{ matrix.python-version }}
|
||||||
- uses: ./.github/actions/python-build
|
- uses: ./.github/actions/python-build
|
||||||
with:
|
with:
|
||||||
build_flavor: ${{ matrix.build-flavor }}
|
build_flavor: ${{ matrix.build-flavor }}
|
||||||
|
numpy_build: "${{ steps.get_numpy.outputs.build_version }}"
|
||||||
|
numpy_dep: "${{ steps.get_numpy.outputs.dep_version }}"
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: "deepspeech-${{ matrix.build-flavor }}-${{ matrix.python-version }}.whl"
|
name: "deepspeech-${{ matrix.build-flavor }}-${{ matrix.python-version }}.whl"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user