Skip to content
This repository was archived by the owner on Jun 9, 2021. It is now read-only.

Commit 4afd79d

Browse files
committed
Version 0.1-alpha3
* Release 0.1-alpha3 * Fixes several failures in TensorFlow unit tests and other bug fixes. * Resolves <#165> * Improves README.
1 parent 555a5e9 commit 4afd79d

File tree

4 files changed

+40
-28
lines changed

4 files changed

+40
-28
lines changed

Diff for: README.md

+31-15
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
### INTRODUCTION
55

6-
This pre-release delivers hardware-accelerated TensorFlow and TensorFlow Addons for macOS 11.0+. Native hardware acceleration is supported on Macs with M1 and Intel-based Macs through Apple’s [ML Compute](https://developer.apple.com/documentation/mlcompute) framework.
6+
This pre-release delivers hardware-accelerated TensorFlow and TensorFlow Addons for macOS 11.0+. Native hardware acceleration is supported on M1 Macs and Intel-based Macs through Apple’s [ML Compute](https://developer.apple.com/documentation/mlcompute) framework.
77

88
### CURRENT RELEASE
99

10-
- 0.1-alpha2
10+
- 0.1-alpha3
1111

1212
### SUPPORTED VERSIONS
1313

@@ -17,35 +17,46 @@ This pre-release delivers hardware-accelerated TensorFlow and TensorFlow Addons
1717
### REQUIREMENTS
1818

1919
- macOS 11.0+
20-
- Python 3.8, available from the [Xcode Command Line Tools](https://developer.apple.com/download/more/?=command%20line%20tools).
20+
- Python 3.8 (required to be downloaded from [Xcode Command Line Tools](https://developer.apple.com/download/more/?=command%20line%20tools) for M1 Macs).
2121

2222
### INSTALLATION
2323

2424
An archive containing Python packages and an installation script can be downloaded from the [releases](https://github.com/apple/tensorflow_macos/releases).
2525

26-
#### Details
27-
2826
- To quickly try this out, copy and paste the following into Terminal:
2927

3028
```
31-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apple/tensorflow_macos/master/scripts/download_and_install.sh)"
29+
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apple/tensorflow_macos/master/scripts/download_and_install.sh)"
3230
```
3331

34-
This will verify your system, ask you for confirmation, then create a virtual environment (https://docs.python.org/3.8/tutorial/venv.html) with TensorFlow for macOS installed.
32+
This will verify your system, ask you for confirmation, then create a [virtual environment](https://docs.python.org/3.8/tutorial/venv.html) with TensorFlow for macOS installed.
3533

3634
- Alternatively, download the archive file from the [releases](https://github.com/apple/tensorflow_macos/releases). The archive contains an installation script, accelerated versions of TensorFlow, TensorFlow Addons, and needed dependencies.
3735

36+
```
37+
% curl -fLO https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha2/tensorflow_macos-${VERSION}.tar.gz
38+
% tar xvzf tensorflow_macos-${VERSION}.tar
39+
% cd tensorflow_macos
40+
% ./install_venv.sh --prompt
41+
```
42+
3843
#### Installation on Conda
3944

4045
This pre-release version supports installation and testing using the Python from Xcode Command Line Tools. See [#153](https://github.com/apple/tensorflow_macos/issues/153) for more information on installation in a Conda environment.
4146

4247
#### Notes
4348

44-
For Macs with M1, the following packages are currently unavailable:
49+
For M1 Macs, the following packages are currently unavailable:
4550

4651
- SciPy and dependent packages
4752
- Server/Client TensorBoard packages
4853

54+
When installing pip packages in a virtual environment, you may need to specify `--target` as follows:
55+
56+
```
57+
% pip install --upgrade -t "${VIRTUAL_ENV}/lib/python3.8/site-packages/" PACKAGE_NAME
58+
```
59+
4960
### ISSUES AND FEEDBACK
5061

5162
Please submit feature requests or report issues via [GitHub Issues](https://github.com/apple/tensorflow_macos/issues).
@@ -56,16 +67,24 @@ Please submit feature requests or report issues via [GitHub Issues](https://gith
5667

5768
It is not necessary to make any changes to your existing TensorFlow scripts to use ML Compute as a backend for TensorFlow and TensorFlow Addons.
5869

59-
There is an optional `mlcompute.set_mlc_device(device_name=any')` API for ML Compute device selection. The default value for `device_name` is `'any`, which means ML Compute will select the best available device on your system, including multiple GPUs on multi-GPU configurations. Other available options are `cpu` and `gpu`. Please note that in eager mode, ML Compute will use the CPU. For example, to choose the CPU device, you may do the following:
70+
There is an optional `mlcompute.set_mlc_device(device_name='any')` API for ML Compute device selection. The default value for `device_name` is `'any'`, which means ML Compute will select the best available device on your system, including multiple GPUs on multi-GPU configurations. Other available options are `'cpu'` and `'gpu'`. Please note that in eager mode, ML Compute will use the CPU. For example, to choose the CPU device, you may do the following:
6071

6172
```
6273
# Import mlcompute module to use the optional set_mlc_device API for device selection with ML Compute.
6374
from tensorflow.python.compiler.mlcompute import mlcompute
6475
6576
# Select CPU device.
66-
mlcompute.set_mlc_device(device_name=cpu) # Available options are 'cpu', 'gpu', and any'.
77+
mlcompute.set_mlc_device(device_name='cpu') # Available options are 'cpu', 'gpu', and 'any'.
6778
```
6879

80+
#### Unsupported TensorFlow Features
81+
82+
The following TensorFlow features are currently not supported in this fork:
83+
84+
- [tf.vectorized_map](https://www.tensorflow.org/api_docs/python/tf/vectorized_map)
85+
- [Higher-order gradients](https://www.tensorflow.org/guide/advanced_autodiff#higher-order_gradients)
86+
- Jacobian-vector products (aka. [forwardprop](https://www.tensorflow.org/api_docs/python/tf/autodiff/ForwardAccumulator))
87+
6988

7089
#### Logs and Debugging
7190

@@ -96,10 +115,7 @@ Unlike graph mode, logging in eager mode is controlled by `TF_CPP_MIN_VLOG_LEVEL
96115

97116
- Larger models being trained on the GPU may use more memory than is available, resulting in paging. If this happens, try decreasing the batch size or the number of layers.
98117
- TensorFlow is multi-threaded, which means that different TensorFlow operations, such as` MLCSubgraphOp`, can execute concurrently. As a result, there may be overlapping logging information. To avoid this during the debugging process, set TensorFlow to execute operators sequentially by setting the number of threads to 1 (see [`tf.config.threading.set_inter_op_parallelism_threads`](https://www.tensorflow.org/api_docs/python/tf/config/threading/set_inter_op_parallelism_threads)).
99-
100-
##### Additional tips for debugging in eager mode:
101-
102-
- To find information about a specific tensor in the log, search for its buffer pointer in the log. If the tensor is defined by an operation that ML Compute does not support, you will need to cast it to `size_t` and search for it in log entries with the pattern `MemoryLogTensorAllocation ... true ptr: <(size_t)ptr>`. You may also need to modify the `OpKernelContext::input()` to print out the input pointer so that you can see the entire use-def chain in the log.
103-
- You may disable the conversion of any eager operation to ML Compute by using `TF_DISABLE_MLC_EAGER=“;Op1;Op2;...”`. The gradient op may also need to be disabled by modifying the file `$PYTHONHOME/site-packages/tensorflow/python/ops/_grad.py` (this avoids TensorFlow recompilation).
118+
- In eager mode, you may disable the conversion of any operation to ML Compute by using `TF_DISABLE_MLC_EAGER=“;Op1;Op2;...”`. The gradient op may also need to be disabled by modifying the file `$PYTHONHOME/site-packages/tensorflow/python/ops/_grad.py` (this avoids TensorFlow recompilation).
104119
- To initialize allocated memory with a specific value, use `TF_MLC_ALLOCATOR_INIT_VALUE=<init-value>`.
120+
- To disable ML Compute acceleration (e.g. for debugging or results verification), set the environment variable `TF_DISABLE_MLC=1`.
105121

Diff for: RELEASE.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Release 0.1-alpha3
2+
3+
* Fixes several failures in TensorFlow unit tests and other bug fixes.
4+
* Resolves <https://github.com/apple/tensorflow_macos/issues/165>
5+
* Improves README.
6+
17
# Release 0.1-alpha2
28

39
* Fixes several failures in TensorFlow unit tests and other bug fixes.

Diff for: scripts/download_and_install.sh

+2-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44

5-
VERSION=0.1alpha2
5+
VERSION=0.1alpha3
66
INSTALLER_PACKAGE=tensorflow_macos-$VERSION.tar.gz
77
INSTALLER_PATH=https://github.com/apple/tensorflow_macos/releases/download/v$VERSION/$INSTALLER_PACKAGE
88
INSTALLER_SCRIPT=install_venv.sh
@@ -20,7 +20,7 @@ echo "Installation script for pre-release tensorflow_macos $VERSION. Please vis
2020
echo "for instructions and license information."
2121
echo
2222
echo "This script will download tensorflow_macos $VERSION and needed binary dependencies, then install them into a new "
23-
echo "or existing Python 3.8 virtual enviornoment."
23+
echo "or existing Python 3.8 virtual environment."
2424

2525
# Make sure the user knows what's going on.
2626
read -p 'Continue [y/N]? '
@@ -57,13 +57,3 @@ bash ./$INSTALLER_SCRIPT --prompt || graceful_error
5757

5858
popd
5959
rm -rf $tmp_dir
60-
61-
62-
63-
64-
65-
66-
67-
68-
69-

Diff for: scripts/install_venv.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ arch_list_arm64=( numpy-1.18.5-cp38-cp38-macosx_11_0_arm64.whl
5353
h5py-2.10.0-cp38-cp38-macosx_11_0_arm64.whl )
5454

5555

56-
tensorflow_version=0.1a2
56+
tensorflow_version=0.1a3
5757

5858

5959
function usage() {

0 commit comments

Comments
 (0)