Tutorials
This section provides a collection of Python tutorials designed to help you get started with TT-NN for tasks such as tensor operations, model conversion, and inference.
To run these tutorials smoothly, we recommend using a Python virtual environment with the necessary dependencies installed. You can set this up in one of two ways:
Full Development Environment: Follow the instructions in the TT-NN / TT-Metal Installation Guide to set up the complete development environment.
Lightweight Tutorial Environment: Use the provided Python Environment Setup Script to create a minimal virtual environment specifically for running the tutorials.
Each tutorial also has an equivalent standalone Python script that you can run locally. These scripts are located in the ttnn/tutorials/basic_python/ directory of the TT-Metal repository.
With your virtual environment activated, you can run the tutorials directly:
$ python3 --version
Python 3.10.12
$ python3 example.py
...
Available tutorials:
- Add Tensors
- More Basic Tensor Operations
- MLP Inference
-
Multi-Head Attention
- Write Multi-Head Attention using ttnn
- Configuration
- Initialize activations and weights using torch
- Convert activations and weights to ttnn
- Run the first iteration of Multi-Head Attention
- Run a subsequent iteration of Multi-Head Attention
- Write optimized version of Multi-Head Attention
- Pre-process the parameters of the optimized model
- Run the first iteration of the optimized Multi-Head Attention
- Run a subsequent iteration of the optimized Multi-Head Attention
- Check that the output of the optimized version matches the output of the original implementation
- Close the device
- Full example and output
- Basic Convolution
- Running a Simple CNN Inference on CIFAR-10