Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TensorFlow install: Add Python versioning info #170

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 79 additions & 38 deletions docs/how-to/3rd-party/tensorflow-install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,13 @@
Installing TensorFlow for ROCm
****************************************************************************************

TensorFlow is an open-source library for solving machine learning,
`TensorFlow <https://www.tensorflow.org>`_ is an open-source library for solving machine learning,
deep learning, and AI problems. It can solve many
problems across different sectors and industries, but primarily focuses on
problems across different sectors and industries but primarily focuses on
neural network training and inference. It is one of the most popular and
in-demand frameworks and is very active in open-source contribution and
development.

.. note::

As of ROCm 6.1, ``tensorflow-rocm`` packages are found at `<https://repo.radeon.com/rocm/manylinux>`__.
Prior to ROCm 6.1, packages were found at `<https://pypi.org/project/tensorflow-rocm>`_.

.. _install-tensorflow-versions:

.. list-table::
:header-rows: 1
:widths: 1, 1

* - ROCm version
- TensorFlow version
* - 6.1.x
- 2.13.1, 2.14.0, 2.15.0
* - 6.0.x
- 2.12.1, 2.13.1, 2.14.0

.. _install-tensorflow-options:

Installing TensorFlow
Expand All @@ -47,19 +29,19 @@ To install ROCm on bare metal, follow
:doc:`/tutorial/install-overview`. The recommended option to
get a TensorFlow environment is through Docker.

Using Docker provides portability and access to a prebuilt Docker image that
has been rigorously tested within AMD. This can also save compilation time and
Using Docker provides portability and access to a prebuilt Docker image
rigorously tested within AMD. This can also save compilation time and
should perform as tested and mitigate potential installation issues.

Follow these steps:

1. Pull the latest public TensorFlow Docker image.
#. Pull the latest public TensorFlow Docker image.

.. code-block:: shell

docker pull rocm/tensorflow:latest

2. Once you have pulled the image, run it by using the command below:
#. Once you have pulled the image, run it by using the command below:

.. code-block:: shell

Expand All @@ -72,21 +54,79 @@ Follow these steps:
Using a wheels package
-------------------------------------------------------------------------------

To install TensorFlow using the wheels package, use the following command.
Follow these steps to install ROCm on Linux using a ready-made Python wheel.

.. code-block:: shell
.. note::

pip install --user tensorflow-rocm==[wheel-version] -f [repo] --upgrade
peterjunpark marked this conversation as resolved.
Show resolved Hide resolved
As of ROCm 6.1, ``tensorflow-rocm`` packages are found at `<https://repo.radeon.com/rocm/manylinux>`__.
Before ROCm 6.1, packages were found at `<https://pypi.org/project/tensorflow-rocm>`__.

* ``[wheel-version]`` is the :ref:`TensorFlow version <install-tensorflow-versions>`.
.. tab-set::

* ``[repo]`` is ``https://repo.radeon.com/rocm/manylinux/rocm-rel-X.Y/`` for versions 6.1 and later,
where ``X.Y`` indicates the :ref:`ROCm version <install-tensorflow-versions>`.
.. tab-item:: ROCm 6.1 and later

.. note::
#. Make sure you're using a supported Python version for the desired ``tensorflow-rocm`` wheel.

a. To check compatible Python versions, navigate to the desired ROCm release version
in `<https://repo.radeon.com/rocm/manylinux/>`__.

b. In the versioned ROCm release directory, take note of the `Python version tag
<https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#python-tag>`_ associated
with the wheel version indicated by ``cp`` in the wheels' file names.

For example, ``tensorflow_rocm-2.15.0-cp310-cp310-manylinux2014_x86_64.whl`` targets Python 3.10, as indicated by
``cp310``.

#. To install TensorFlow, use the following command. Replace ``[wheel-version]`` and the ROCm version ``[major.minor]``
as appropriate.

.. code-block:: shell

For details on ``tensorflow-rocm`` wheels and ROCm version compatibility, refer to
`<https://github.com/ROCm/tensorflow-upstream/blob/develop-upstream/rocm_docs/tensorflow-rocm-release.md>`__.
pip install --user tensorflow-rocm==[wheel-version] -f https://repo.radeon.com/rocm/manylinux/rocm-rel-[major.minor] --upgrade

* ``[wheel-version]`` indicates the TensorFlow version.

* ``[major.minor]`` indicates the `ROCm release version <https://repo.radeon.com/rocm/manylinux/>`_; for instance,
``6.1``.

.. tab-item:: Before ROCm 6.1

#. Make sure you're using a supported Python version for the desired ``tensorflow-rocm`` wheel.

#. To install TensorFlow, use the following command. Replace ``[wheel-version]`` with the appropriate
``tensorflow-rocm`` version `from PyPI <https://pypi.org/project/tensorflow-rocm/#history>`_.

See ROCm versions with their associated ``tensorflow-rocm`` versions in
`<https://github.com/ROCm/tensorflow-upstream/blob/develop-upstream/rocm_docs/tensorflow-rocm-release.md>`__.

.. code-block:: shell

pip install --user tensorflow-rocm==[wheel-version] --upgrade

.. _install-tensorflow-versions:

The following table associates ROCm versions with their supported TensorFlow versions.

.. list-table::
:header-rows: 1

* - ROCm version
- TensorFlow version
* - 6.1.x
- .. list-table::

* - 2.13.1
- 2.14.0
- 2.15.0

* - 6.0.x
- .. list-table::

* - 2.12.1
- 2.13.1
- 2.14.0
For details on ``tensorflow-rocm`` wheels and ROCm version compatibility, refer to
`<https://github.com/ROCm/tensorflow-upstream/blob/develop-upstream/rocm_docs/tensorflow-rocm-release.md>`__.

.. _test-tensorflow-installation:

Expand All @@ -104,10 +144,11 @@ shell in the Docker container.
Running a basic TensorFlow example
======================================

To quickly validate your TensorFlow environment, let's run a basic TensorFlow example.
Run a basic TensorFlow example to test your TensorFlow environment.

The MNIST dataset is a collection of handwritten digits that may be used to train a Convolutional Neural Network (CNN)
for handwriting recognition. This dataset is included with your TensorFlow installation.
The MNIST dataset is a collection of handwritten digits that may be used to
train a convolutional neural network (CNN) for handwriting recognition. This
dataset is included with your TensorFlow installation.

Run the following sample code to load the MNIST dataset, then train and evaluate it.

Expand All @@ -116,7 +157,7 @@ Run the following sample code to load the MNIST dataset, then train and evaluate
import tensorflow as tf
print("TensorFlow version:", tf.__version__)
mnist = tf.keras.datasets.mnist

(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
model = tf.keras.models.Sequential([
Expand All @@ -135,7 +176,7 @@ Run the following sample code to load the MNIST dataset, then train and evaluate
model.fit(x_train, y_train, epochs=5)
model.evaluate(x_test, y_test, verbose=2)

If successful, you should see the following output indicating the image classifier is now trained to around 98% accuracy
If successful, you should see the following output indicating the image classifier is now trained to around 98 percent accuracy
on this dataset.

.. image:: ../../data/install/tensorflow-install/tensorflow-test-output.png
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/_toc.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ subtrees:
- file: how-to/3rd-party/jax-install
title: JAX
- file: how-to/3rd-party/magma-install
title: Magma
title: MAGMA

- caption: How-to
entries:
Expand Down
Loading