Skip to content

Commit

Permalink
[TFLite][CI] Update TensorFlow dependency to 2.9.1
Browse files Browse the repository at this point in the history
This updates the TF version to be used in TVM CI to 2.9.1,
which brings improvements so that more platforms are supported by
official packages.

When building TFLite, an update to CMake was also required,
which is updated now to 3.18.4.

ethos-u-vela dependency is also updated, from version 3.2.0 to 3.4.0
so that it is closer to the TensorFlow version being proposed here.

This PR updates the Docker images scripting to install TF and TFLite.

Change-Id: I290085f0c018ad57606f1295494c19ff6e1af2dd
  • Loading branch information
leandron committed Sep 5, 2022
1 parent 0549a08 commit 22fd81d
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 31 deletions.
2 changes: 2 additions & 0 deletions cmake/modules/contrib/TFLite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ if(NOT USE_TFLITE STREQUAL "OFF")
set(USE_TFLITE ${USE_TENSORFLOW_PATH}/tensorflow/lite/tools/make/gen/*/lib)
endif()
find_library(TFLITE_CONTRIB_LIB libtensorflow-lite.a ${USE_TFLITE})
file(GLOB_RECURSE TFLITE_DEPS "${USE_TFLITE}/*.a")

list(APPEND TVM_RUNTIME_LINKER_LIBS ${TFLITE_CONTRIB_LIB})
list(APPEND TVM_RUNTIME_LINKER_LIBS ${TFLITE_DEPS})

if (NOT USE_FLATBUFFERS_PATH STREQUAL "none")
include_directories(${USE_FLATBUFFERS_PATH}/include)
Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile.ci_cortexm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ RUN bash /install/ubuntu_install_googletest.sh
COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh
RUN bash /install/ubuntu1804_install_python.sh

COPY install/ubuntu_install_cmake_source.sh /install/ubuntu_install_cmake_source.sh
RUN bash /install/ubuntu_install_cmake_source.sh

COPY install/ubuntu1804_install_python_venv.sh /install/ubuntu1804_install_python_venv.sh
RUN bash /install/ubuntu1804_install_python_venv.sh
ENV PATH=/opt/tvm-venv/bin:/opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin:$PATH
Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile.ci_cpu
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ RUN bash /install/ubuntu_install_python_package.sh
COPY install/ubuntu1804_install_llvm.sh /install/ubuntu1804_install_llvm.sh
RUN bash /install/ubuntu1804_install_llvm.sh

COPY install/ubuntu_install_cmake_source.sh /install/ubuntu_install_cmake_source.sh
RUN bash /install/ubuntu_install_cmake_source.sh

COPY install/ubuntu_install_dnnl.sh /install/ubuntu_install_dnnl.sh
RUN bash /install/ubuntu_install_dnnl.sh

Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile.ci_gpu
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ RUN apt-get update --fix-missing
COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
RUN bash /install/ubuntu_install_core.sh

COPY install/ubuntu_install_cmake_source.sh /install/ubuntu_install_cmake_source.sh
RUN bash /install/ubuntu_install_cmake_source.sh

COPY install/ubuntu_install_googletest.sh /install/ubuntu_install_googletest.sh
RUN bash /install/ubuntu_install_googletest.sh

Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile.ci_riscv
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ RUN bash /install/ubuntu_install_googletest.sh
COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh
RUN bash /install/ubuntu1804_install_python.sh

COPY install/ubuntu_install_cmake_source.sh /install/ubuntu_install_cmake_source.sh
RUN bash /install/ubuntu_install_cmake_source.sh

COPY install/ubuntu1804_install_python_venv.sh /install/ubuntu1804_install_python_venv.sh
RUN bash /install/ubuntu1804_install_python_venv.sh
ENV PATH=/opt/tvm-venv/bin:/opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin:$PATH
Expand Down
4 changes: 2 additions & 2 deletions docker/install/ubuntu_install_cmake_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ set -e
set -u
set -o pipefail

v=3.14
version=3.14.7
v=3.18
version=3.18.4
wget https://cmake.org/files/v${v}/cmake-${version}.tar.gz
tar xvf cmake-${version}.tar.gz
cd cmake-${version}
Expand Down
2 changes: 1 addition & 1 deletion docker/install/ubuntu_install_python_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pip3 install --upgrade \
cython \
decorator \
mypy \
numpy~=1.19.5 \
numpy==1.21.* \
orderedset \
packaging \
Pillow==9.1.0 \
Expand Down
5 changes: 2 additions & 3 deletions docker/install/ubuntu_install_tensorflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ set -u
set -o pipefail

pip3 install \
"h5py==3.1.0" \
keras==2.6 \
tensorflow==2.6.5
keras==2.9 \
tensorflow==2.9.1
23 changes: 2 additions & 21 deletions docker/install/ubuntu_install_tensorflow_aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,8 @@ set -euxo pipefail
# Build dependencies
apt-install-and-clear -y --no-install-recommends libhdf5-dev

# Downloading Tensorflow and installing it manually is needed
# just as a temporary workaround while we move to a newer
# version (>2.7) that is hosted in the official PyPI repository.
linaro_repo="https://snapshots.linaro.org/ldcg/python/tensorflow-manylinux/43/tensorflow-aarch64"
tensorflow_package="tensorflow_aarch64-2.6.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
tmpdir=$(mktemp -d)

cleanup()
{
rm -rf "$tmpdir"
}

trap cleanup 0

cd "${tmpdir}"
wget -q "${linaro_repo}/${tensorflow_package}"

# We're only using the TensorFlow wheel snapshot here as the
# h5py wheel tries to use the wrong .so file
pip3 install \
${tensorflow_package} \
"h5py==3.1.0" \
keras==2.6 \
"protobuf<4"
keras==2.9 \
tensorflow-aarch64==2.9.1
13 changes: 11 additions & 2 deletions docker/install/ubuntu_install_tflite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

set -e
set -u
set -x
set -o pipefail

# The tflite version should have matched versions to the tensorflow
Expand All @@ -38,8 +39,16 @@ pip3 install flatbuffers
# The library is built at:
# tensorflow/tensorflow/lite/tools/make/gen/*/lib/libtensorflow-lite.a.
git clone https://github.com/tensorflow/tensorflow --branch=v${TENSORFLOW_VERSION} --depth 1
./tensorflow/tensorflow/lite/tools/make/download_dependencies.sh
./tensorflow/tensorflow/lite/tools/make/build_lib.sh

mkdir -p /opt/tflite
cd /opt/tflite
cmake \
-DTFLITE_ENABLE_XNNPACK=OFF \
/tensorflow/tensorflow/lite

cmake --build .
cd -


# Setup tflite from schema
mkdir tflite
Expand Down
2 changes: 1 addition & 1 deletion docker/install/ubuntu_install_vela.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ set -e
set -u
set -o pipefail

pip3 install ethos-u-vela==3.2.0
pip3 install ethos-u-vela==3.4.0
2 changes: 1 addition & 1 deletion docker/install/ubuntu_install_zephyr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sudo apt-install-and-clear -y --no-install-recommends \
git cmake ninja-build gperf \
ccache dfu-util device-tree-compiler wget \
python3-dev python3-pip python3-setuptools python3-tk python3-wheel python3-venv \
xz-utils file make gcc gcc-multilib g++-multilib apt-transport-https
xz-utils file make gcc gcc-multilib g++-multilib apt-transport-https libudev-dev

wget --no-verbose https://apt.kitware.com/keys/kitware-archive-latest.asc
sudo apt-key add kitware-archive-latest.asc
Expand Down

0 comments on commit 22fd81d

Please sign in to comment.