From be3d4ed5ca69f8e7d5fd6afefe4ae82084bf0fa2 Mon Sep 17 00:00:00 2001 From: Huy Le Nguyen Date: Sat, 4 May 2024 23:37:08 +0700 Subject: [PATCH] fix: add instruction for apple sillicon installation for tensorflow-text --- README.md | 14 ++++++++++++++ requirements.txt | 48 ++++++++++++++++-------------------------------- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index e895743aa2..930c098aa3 100755 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ TensorFlowASR implements some automatic speech recognition architectures such as - [Installing from source (recommended)](#installing-from-source-recommended) - [Installing via PyPi](#installing-via-pypi) - [Installing for development](#installing-for-development) + - [Install for Apple Sillicon](#install-for-apple-sillicon) - [Running in a container](#running-in-a-container) - [Training \& Testing Tutorial](#training--testing-tutorial) - [Features Extraction](#features-extraction) @@ -110,6 +111,19 @@ pip3 install -e ".[dev]" pip3 install -e ".[tf2.x]" # or ".[tf2.x-gpu]" or ".[tf2.x-apple]" for apple m1 machine ``` +### Install for Apple Sillicon + +Due to tensorflow-text is not built for Apple Sillicon, we need to install it with the prebuilt wheel file from [sun1638650145/Libraries-and-Extensions-for-TensorFlow-for-Apple-Silicon](https://github.com/sun1638650145/Libraries-and-Extensions-for-TensorFlow-for-Apple-Silicon) + +Do this after installing TensorFlowASR with tensorflow above + +```bash +TF_VERSION="$(python3 -c 'import tensorflow; print(tensorflow.__version__)')" && \ +TF_VERSION_MAJOR="$(echo $TF_VERSION | cut -d'.' -f1,2)" && \ +URL="https://github.com/sun1638650145/Libraries-and-Extensions-for-TensorFlow-for-Apple-Silicon" && \ +pip3 install "${URL}/releases/download/v${TF_VERSION_MAJOR}/tensorflow_text-${TF_VERSION_MAJOR}.0-cp310-cp310-macosx_11_0_arm64.whl" +``` + ### Running in a container ```bash diff --git a/requirements.txt b/requirements.txt index d97ffc0f3b..512cf8de66 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,49 +20,33 @@ pydot==1.4.2 graphviz==0.20.1 # extra=tf2-12 -tensorflow>=2.12.0,<2.13.0 -tensorflow-text>=2.12.0,<2.13.0 +tensorflow~=2.12.0 +tensorflow-text~=2.12.0 # extra=tf2-12-gpu -tensorflow[and-cuda]>=2.12.0,<2.13.0 -tensorflow-text>=2.12.0,<2.13.0 - -# extra=tf2-12-apple -tensorflow-macos>=2.12.0,<2.13.0 -tensorflow-text @ https://github.com/sun1638650145/Libraries-and-Extensions-for-TensorFlow-for-Apple-Silicon/releases/download/v2.12/tensorflow_text-2.12.0-cp310-cp310-macosx_11_0_arm64.whl +tensorflow[and-cuda]~=2.12.0 +tensorflow-text~=2.12.0 # extra=tf2-13 -tensorflow>=2.13.0,<2.14.0 -tensorflow-text>=2.13.0rc0,<2.14.0 +tensorflow~=2.13.0 +tensorflow-text~=2.13.0rc0 # extra=tf2-13-gpu -tensorflow[and-cuda]>=2.13.0,<2.14.0 -tensorflow-text>=2.13.0rc0,<2.14.0 - -# extra=tf2-13-apple -tensorflow>=2.13.0,<2.14.0 # https://blog.tensorflow.org/2023/07/whats-new-in-tensorflow-213-and-keras-213.html -tensorflow-text @ https://github.com/sun1638650145/Libraries-and-Extensions-for-TensorFlow-for-Apple-Silicon/releases/download/v2.13/tensorflow_text-2.13.0-cp310-cp310-macosx_11_0_arm64.whl +tensorflow[and-cuda]~=2.13.0 +tensorflow-text~=2.13.0rc0 # extra=tf2-14 -tensorflow>=2.14.0,<2.15.0 -tensorflow-text>=2.14.0,<2.15.0 +tensorflow~=2.14.0 +tensorflow-text~=2.14.0 # extra=tf2-14-gpu -tensorflow[and-cuda]>=2.14.0,<2.15.0 -tensorflow-text>=2.14.0,<2.15.0 - -# extra=tf2-14-apple -tensorflow>=2.14.0,<2.15.0 -tensorflow-text @ https://github.com/sun1638650145/Libraries-and-Extensions-for-TensorFlow-for-Apple-Silicon/releases/download/v2.14/tensorflow_text-2.14.0-cp310-cp310-macosx_11_0_arm64.whl +tensorflow[and-cuda]~=2.14.0 +tensorflow-text~=2.14.0 # extra=tf2-15 -tensorflow>=2.15.0,<2.16.0 -tensorflow-text>=2.15.0,<2.16.0 +tensorflow~=2.15.0 +tensorflow-text~=2.15.0 # extra=tf2-15-gpu -tensorflow[and-cuda]>=2.15.0,<2.16.0 -tensorflow-text>=2.15.0,<2.16.0 - -# extra=tf2-15-apple -tensorflow>=2.15.0,<2.16.0 -tensorflow-text @ https://github.com/sun1638650145/Libraries-and-Extensions-for-TensorFlow-for-Apple-Silicon/releases/download/v2.15/tensorflow_text-2.15.0-cp310-cp310-macosx_11_0_arm64.whl +tensorflow[and-cuda]~=2.15.0 +tensorflow-text~=2.15.0 \ No newline at end of file