Skip to content

Commit d738eb6

Browse files
committed
Update tf-text 2.12.0.
1 parent 82049c4 commit d738eb6

File tree

4 files changed

+49
-29
lines changed

4 files changed

+49
-29
lines changed

README-zh.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010

1111
## 注意 ⚠️
1212

13-
`tensorflow-macos 2.9.0``tensorflow-metal 0.5.0`才开始提供了`Python 3.10`的支持, `tensorflow-text`暂不支持`Python 3.10`.
13+
`tensorflow-macos 2.9.0``tensorflow-metal 0.5.0`才开始提供了`Python 3.10`的支持.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ This Repo will provide TensorFlow libraries and extended build tutorials that re
1010

1111
## Note ⚠️
1212

13-
`Python 3.10` support has been provided since `tensorflow-macos 2.9.0` and `tensorflow-metal 0.5.0`, `tensorflow-text` does not currently support `Python 3.10`.
13+
`Python 3.10` support has been provided since `tensorflow-macos 2.9.0` and `tensorflow-metal 0.5.0`.

tutorials/text/text-zh.md

+23-13
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,62 @@
11
# 从源码构建TensorFlow Text
22

3+
## 注意 ⚠️
4+
5+
请使用`Xcode 14.3``Apple clang version 14.0.3 (clang-1403.0.22.14.1)`.
6+
37
## 必要条件
48

5-
这里假设了您有必要的类Unix知识, 已经在您的终端内安装好了[`brew`](https://brew.sh)[`conda`](https://github.com/conda-forge/miniforge), 这里不再赘述`brew``conda`安装和使用方法; 最重要的是, 这个教程完全基于Apple Silicon(比如M1, M1 Pro, M1 Max或M1 Ultra)构建, 所以确保您手中的Mac是Apple Silicon.
9+
这里假设了您有必要的类Unix知识, 已经在您的终端内安装好了[`brew`](https://brew.sh)[`conda`](https://github.com/conda-forge/miniforge), 这里不再赘述`brew``conda`安装和使用方法; 最重要的是, 这个教程完全基于Apple Silicon构建, 所以确保您手中的Mac是Apple Silicon.
610

711
## Step by Step
812

913
1. 创建新的环境并安装Apple提供的依赖项.
1014

1115
```shell
12-
conda create -n tensorflow-macos python=3.9 # 这里Python版本也可以使用Python 3.8
16+
conda create -n tensorflow-macos python=3.10 # 这里Python版本也可以使用Python 3.8和3.9
1317
conda activate tensorflow-macos
14-
conda install -c apple tensorflow-deps==2.9.0
18+
conda install -c apple tensorflow-deps==2.10.0 # 目前Apple没有发布tensorflow-deps 2.11和2.12, 2.10就是最新版.
1519
```
1620

1721
2. 安装`tensorFlow-macos``tensorflow-metal`插件.
1822

1923
```shell
20-
pip install tensorflow-macos==2.9.0
21-
pip install tensorflow-metal==0.5.0
24+
pip install tensorflow-macos==2.12.0
25+
pip install tensorflow-metal==0.8.0
2226
```
2327

24-
3. 安装`bazel 5.1.1`.
28+
3. 安装`bazel 5.3.0`.
2529

2630
```shell
27-
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/2940e900476b4452c8047c75dcbfc193c6f30341/Formula/bazel.rb
31+
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/59dff37de3c670a77c1e9f39b8a4b0f8884a391b/Formula/bazel.rb
2832
brew install ./bazel.rb
29-
bazel --version # 确保版本是5.1.x即可.
33+
bazel --version # 确保版本是5.3.0即可.
3034
```
3135

3236
* 通常情况下`brew`安装的`bazel`会是最新版的, 最新版往往和`text`要求的版本不匹配, 这可能会出现很多意想不到的问题, 所以我们通过手动指定版本安装.
3337

34-
4. 下载并解压`text 2.9.0`.
38+
4. 下载并解压`text 2.12.0`.
3539

3640
```shell
37-
wget https://github.com/tensorflow/text/archive/refs/tags/v2.9.0.zip
38-
unzip ./v2.9.0.zip
39-
cd text-2.9.0
41+
wget https://github.com/tensorflow/text/archive/refs/tags/v2.12.0.zip
42+
unzip ./v2.12.0.zip
43+
cd text-2.12.0
4044
```
4145

4246
5. 修改源码的一些参数以此确保能正确构建.
4347

4448
* `oss_scripts/configure.sh`修改第49行为
4549

4650
```shell
47-
pip install tensorflow-macos==2.9.0
51+
pip install tensorflow-macos==2.12.0
4852
```
4953

54+
* (可选, 如果你没有通过`brew`安装`bazel`请直接跳过)`oss_scripts/run_build.sh`修改第19行为
55+
56+
```shell
57+
tf_bazel_version='5.3.0-homebrew'
58+
```
59+
5060
6. 运行脚本构建.
5161

5262
```shell

tutorials/text/text.md

+24-14
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,62 @@
11
# Build TensorFlow Text from source
22

3+
## Attention ⚠️
4+
5+
Please use `Xcode 14.3` and `Apple clang version 14.0.3 (clang-1403.0.22.14.1)`.
6+
37
## Necessary conditions
48

5-
It is assumed here that you have the necessary Unix-Like knowledge, [`brew`](https://brew.sh) and [`conda`](https://github.com/conda-forge/miniforge) have been installed in your terminal, and the installation and use methods of `brew` and `conda` will not be repeated here; most importantly, this tutorial is completely based on Apple Silicon (such as M1, M1 Pro, M1 Max and M1 Ultra) build, so make sure your Mac is Apple Silicon.
9+
It is assumed here that you have the necessary Unix-Like knowledge, [`brew`](https://brew.sh) and [`conda`](https://github.com/conda-forge/miniforge) have been installed in your terminal, and the installation and use methods of `brew` and `conda` will not be repeated here; most importantly, this tutorial is completely based on Apple Silicon build, so make sure your Mac is Apple Silicon.
610

711
## Step by Step
812

913
1. Create a new Env and install the dependencies provided by Apple.
1014

1115
```shell
12-
conda create -n tensorflow-macos python=3.9 # This Python version can also use 3.8
16+
conda create -n tensorflow-macos python=3.10 # This Python version can also use 3.8 and 3.9
1317
conda activate tensorflow-macos
14-
conda install -c apple tensorflow-deps==2.9.0
18+
conda install -c apple tensorflow-deps==2.10.0 # Currently Apple has not released tensorflow-deps 2.11 and 2.12, 2.10 is the latest version.
1519
````
1620

1721
2. Install the `tensorflow-macos` and `tensorflow-metal` plugins.
1822

1923
```shell
20-
pip install tensorflow-macos==2.9.0
21-
pip install tensorflow-metal==0.5.0
24+
pip install tensorflow-macos==2.12.0
25+
pip install tensorflow-metal==0.8.0
2226
````
2327
24-
3. Install `bazel 5.1.1`.
28+
3. Install `bazel 5.3.0`.
2529
2630
```shell
27-
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/2940e900476b4452c8047c75dcbfc193c6f30341/Formula/bazel.rb
31+
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/59dff37de3c670a77c1e9f39b8a4b0f8884a391b/Formula/bazel.rb
2832
brew install ./bazel.rb
29-
bazel --version # Make sure the version is 5.1.x.
33+
bazel --version # Make sure the version is 5.3.0.
3034
````
3135

3236
* Usually, the `bazel` installed by `brew` will be the latest version. The latest version often does not match the version required by `text`, which may cause many unexpected problems, so we install it by specifying the version manually.
3337

34-
4. Download and extract `text 2.9.0`.
38+
4. Download and extract `text 2.12.0`.
3539

3640
```shell
37-
wget https://github.com/tensorflow/text/archive/refs/tags/v2.9.0.zip
38-
unzip ./v2.9.0.zip
39-
cd text-2.9.0
41+
wget https://github.com/tensorflow/text/archive/refs/tags/v2.12.0.zip
42+
unzip ./v2.12.0.zip
43+
cd text-2.12.0
4044
````
4145
4246
5. Modify some parameters of the source code to ensure correct build.
4347
4448
* `oss_scripts/configure.sh` to modify line 49:
4549
4650
```shell
47-
pip install tensorflow-macos==2.9.0
51+
pip install tensorflow-macos==2.12.0
4852
````
49-
53+
54+
* (Optional, if you have not installed `bazel` through `brew`, please skip it) `oss_scripts/run_build.sh` modify line 19:
55+
56+
```shell
57+
tf_bazel_version='5.3.0-homebrew'
58+
```
59+
5060
6. Run the script.
5161

5262
```shell

0 commit comments

Comments
 (0)