Skip to content

Commit

Permalink
Tabify wheels installation
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjunpark committed Jun 5, 2024
1 parent b59d9de commit 6dccd3b
Showing 1 changed file with 64 additions and 38 deletions.
102 changes: 64 additions & 38 deletions docs/how-to/3rd-party/tensorflow-install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
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.
Expand All @@ -29,8 +29,8 @@ 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:
Expand All @@ -54,48 +54,73 @@ Follow these steps:
Using a wheels package
-------------------------------------------------------------------------------

#. Ensure your environment is using a supported Python version for the desired ``tensorflow-rocm`` wheel.
Follow these steps to install ROCm on Linux using a ready-made Python wheel.

a. To check compatible Python versions, navigate to the desired ROCm release version
in `<https://repo.radeon.com/rocm/manylinux/>`__.
The following table associates ROCm versions with their supported TensorFlow versions.

b. In the versioned ROCm release directory, take note of the Python versions associated with the desired
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``.
.. list-table::
:header-rows: 1

#. To install TensorFlow, use the following command. Replace ``[wheel-version]`` and the ROCm version ``[major.minor]``
as appropriate.
* - ROCm version
- TensorFlow version
* - 6.1.x
- .. list-table::

.. code-block:: shell
* - 2.13.1
- 2.14.0
- 2.15.0

pip install --user tensorflow-rocm==[wheel-version] -f https://repo.radeon.com/rocm/manylinux/rocm-rel-[major.minor] --upgrade
* - 6.0.x
- .. list-table::

* ``[wheel-version]`` indicates the TensorFlow version.
* - 2.12.1
- 2.13.1
- 2.14.0

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

.. _install-tensorflow-versions:
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>`__.

The following table associates ROCm versions with their supported TensorFlow versions.
.. tab-set::

.. list-table::
:header-rows: 1
.. tab-item:: ROCm 6.1 and later

* - 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
#. Ensure your environment uses a supported Python version for the desired ``tensorflow-rocm`` wheel.

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

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>`_.
b. In the versioned ROCm release directory, take note of the Python versions associated with the desired
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
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:: Prior to ROCm 6.1

#. Ensure your environment uses a supported Python version for the desired ``tensorflow-rocm`` wheel.

#. To install TensorFlow, use the following command. Replace ``[wheel-version]`` with the appropriate
TensorFlow version.

.. code-block:: shell
pip install --user tensorflow-rocm==[wheel-version] --upgrade
.. _install-tensorflow-versions:

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>`__.
Expand All @@ -116,10 +141,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 validate your TensorFlow enviroment.

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 @@ -128,7 +154,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 @@ -147,7 +173,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

0 comments on commit 6dccd3b

Please sign in to comment.