Skip to content

Latest commit

 

History

History
82 lines (54 loc) · 2.34 KB

File metadata and controls

82 lines (54 loc) · 2.34 KB

Python TensorFlow TensorFlow Torch Contributions Maintenance

TensorFlow & PyTorch

API Tutorial

About

This repository provides hands-on tutorials about the Sequential API, Functional API, and Model Subclassing in TensorFlow and PyTorch.

Table of Contents

Setting Up the Development Environment

Important: Ensure that the versions of TensorFlow or PyTorch you install are compatible with your Python version and GPU drivers/CUDA versions.

This setup has been tested with an NVIDIA L40S 48GB GPU running driver version 550.127.08, which is backward compatible with earlier CUDA versions (e.g., CUDA 11.8).

  • Verify GPU availability:
nvidia-smi

PyTorch Setup

  • Create and activate the environment:
conda env create -f torch_env.yml && conda activate torch-env
  • Verify the GPU installation:
python -c "import torch; [print(f'GPU {i}: {torch.cuda.get_device_name(i)}') for i in range(torch.cuda.device_count())]"

Expected output:

GPU 0: NVIDIA L40S
GPU 1: NVIDIA L40S

TensorFlow Setup

  • TensorFlow-CPU:
conda env create -f tf_cpu_env.yml && conda activate tf-cpu-env
  • TensorFlow-GPU:
conda env create -f tf_gpu_env.yml && conda activate tf-gpu-env
  • Verify the GPU installation:
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

Expected output:

[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:1', device_type='GPU')]