赞
踩
An archive containing Python packages and an installation script can be downloaded from the releases.
可以从发行版下载包含 Python 包和安装脚本的存档。
- % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apple/tensorflow_macos/master/scripts/download_and_install.sh)"
-
-
-
- This will verify your system, ask you for confirmation, then create a virtual environment with TensorFlow for macOS installed.
- 这将验证您的系统,要求您确认,然后创建一个安装了 TensorFlow for macOS 的虚拟环境。
-
-
-
- Alternatively, download the archive file from the releases. The archive contains an installation script, accelerated versions of TensorFlow, TensorFlow Addons, and needed dependencies.
- 或者,从发行版下载存档文件。该存档包含安装脚本、TensorFlow 加速版本、TensorFlow 插件和所需的依赖项。
- % curl -fLO https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha2/tensorflow_macos-${VERSION}.tar.gz % tar xvzf tensorflow_macos-${VERSION}.tar % cd tensorflow_macos % ./install_venv.sh --prompt
This pre-release version supports installation and testing using the Python from Xcode Command Line Tools. See #153 for more information on installation in a Conda environment.
此预发布版本支持使用 Xcode 命令行工具中的 Python 进行安装和测试。有关在 Conda 环境中安装的更多信息,请参见 #153。
For M1 Macs, the following packages are currently unavailable:
对于 M1 Mac,以下软件包目前不可用:
When installing pip packages in a virtual environment, you may need to specify --target
as follows:
在虚拟环境中安装 pip 包时,可能需要指定 --target
如下:
% pip install --upgrade -t "${VIRTUAL_ENV}/lib/python3.8/site-packages/" PACKAGE_NAME
Please submit feature requests or report issues via GitHub Issues.
请通过 GitHub 问题提交功能请求或报告问题。
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.
无需对现有 TensorFlow 脚本进行任何更改,即可将 ML Compute 用作 TensorFlow 和 TensorFlow 插件的后端。
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:
有一个可选 mlcompute.set_mlc_device(device_name='any')
的 API 用于 ML 计算设备选择。的 device_name
默认值为 , 'any'
这意味着 ML 计算将选择系统上的最佳可用设备,包括多 GPU 配置上的多个 GPU。其他可用选项包括 'cpu'
和 'gpu'
。请注意,在预先模式下,ML 计算将使用 CPU。例如,要选择 CPU 设备,您可以执行以下操作:
# Import mlcompute module to use the optional set_mlc_device API for device selection with ML Compute. from tensorflow.python.compiler.mlcompute import mlcompute # Select CPU device. mlcompute.set_mlc_device(device_name='cpu') # Available options are 'cpu', 'gpu', and 'any'.
The following TensorFlow features are currently not supported in this fork:
此分支目前不支持以下 TensorFlow 功能:
Logging provides more information about what happens when a TensorFlow model is optimized by ML Compute. Turn logging on by setting the environment variable TF_MLC_LOGGING=1
when executing the model script. The following is the list of information that is logged in graph mode:
日志记录提供了有关 ML 计算优化 TensorFlow 模型时发生的情况的更多信息。通过在执行模型脚本时设置环境变量 TF_MLC_LOGGING=1
来打开日志记录。以下是在图形模式下记录的信息列表:
Unlike graph mode, logging in eager mode is controlled by TF_CPP_MIN_VLOG_LEVEL
. The following is the list of information that is logged in eager mode:
与图形模式不同,预先模式中的日志记录由 TF_CPP_MIN_VLOG_LEVEL
控制。以下是在预先模式下记录的信息列表:
MLCTraining
or MLCInference
graph. This key is used to retrieve the graph and run a backward pass or an optimizer update.MLCTraining
or MLCInference
图的键。此键用于检索图形并运行向后传递或优化器更新。 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
).MLCSubgraphOp
)可以并发执行。因此,可能存在重叠的日志记录信息。为了避免在调试过程中出现这种情况,请通过将线程数设置为 1 来将 TensorFlow 设置为按顺序执行运算符(请参阅 tf.config.threading.set_inter_op_parallelism_threads
)。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).TF_DISABLE_MLC_EAGER=“;Op1;Op2;...”
禁用任何操作到 ML 计算的转换。可能还需要通过修改文件 $PYTHONHOME/site-packages/tensorflow/python/ops/_grad.py
来禁用梯度运算(这样可以避免 TensorFlow 重新编译)。TF_MLC_ALLOCATOR_INIT_VALUE=<init-value>
.TF_MLC_ALLOCATOR_INIT_VALUE=<init-value>
。TF_DISABLE_MLC=1
.TF_DISABLE_MLC=1
。Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。