Datasets
Catalog
TensorFlow Datasets
Educational resources to learn the fundamentals of ML with TensorFlow
www.tensorflow.org
Install/Load
TensorFlow Datasets
TensorFlow Lite for mobile and embedded devices
www.tensorflow.org
GPU Configuration
Distributed Training (TF2)
Instantiate TF's Mirrored Strategy
# To available GPUs
mirrored_strategy = tf.distribute.MirroredStrategy()
# Specified GPUs
mirrored_strategy = tf.distribute.MirroredStrategy(devices=["/gpu:0", "/gpu:1"])Strategy Scope
Setup the model and optimizer within the strategy's scope to make them mirrored variables.
with mirrored_strategy.scope():
model = tf.keras.Sequential([tf.keras.layers.Dense(1, input_shape=(1,))])
optimizer = tf.keras.optimizers.SGD()Resource: https://www.tensorflow.org/guide/distributed_training
Distributed Training with MNIST Dataset:
MNIST DatasetDistributed Training (TF1)
Allocate GPU Memory
# Specify use of 85% GPU memory
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction = 0.85)
# Integrate within session parameter
with tf.Session(config = tf.ConfigProto(gpu_options = gpu_options)) as sessGPU Acceleration
For a NVIDIA GPU configured for such applications, install NVIDIA CUDA Toolkit. Using the Anaconda Navigator, the following packages are installed in support of the tensorflow-gpu package.
tflow_select
cudatoolkit
cudnn
tensorflow
tensorflow-base
Once installed, the accessing the environment into which the above packages were installed can be used to confirm TensorFlow's recognition of the GPU with the following:
$ python
Python 3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.import tensorflow as tf
tf.test.gpu_device_name()The above call returns output confirming its connection to the GPU.
Additional Hardware Resource:
Hardware & Driver Setup
Resources
Installation
Install TensorFlow with pip
python3 --version pip3 --version sudo apt update sudo apt install python3-dev python3-pip python3-venv Install using the Homebrew package manager: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" export PATH="/usr/local/opt/python/libexec/bin:$PATH" # if you are on macOS 10.12 (Sierra) use `export PATH="/usr/local/bin:/usr/local/sbin:$PATH"` brew update brew install python # Python 3 Install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, and 2019.
www.tensorflow.org
Python - TensorFlow 2
All symbols in TensorFlow 2 | TensorFlow Core v2.4.1
Educational resources to learn the fundamentals of ML with TensorFlow
www.tensorflow.org