This directory contains sample PyTorch Neuron inference and training scripts that can be run on AWS Trainium (Trn1/Trn1n instances) and AWS Inferentia (Inf2 instances).
For additional information on these training scripts, please refer to the tutorials found in the official Trainium documentation.
The following samples are available for training:
Name | Description | Training Parallelism |
---|---|---|
dp_bert_hf_pretrain | Phase1 and phase2 pretraining of Hugging Face BERT-large model | DataParallel |
mnist_mlp | Examples of training a multilayer perceptron on the MNIST dataset | DataParallel |
mnist_mlp | Examples of training a multilayer perceptron on the MNIST dataset using DDP | DataParallel |
hf_text_classification | Fine-tuning various Hugging Face models for a text classification task | DataParallel |
hf_image_classification | Fine-tuning Hugging Face models (ex. ViT) for a image classification task | DataParallel |
hf_contrastive_image_text | Fine-tuning Multi-modal Image and Text Hugging Face models (ex. CLIP) | DataParallel |
hf_language_modeling | Training Hugging Face models (ex. GPT2) for causal language modeling (CLM) | DataParallel |
hf_bert_jp | Fine-tuning & Deployment Hugging Face BERT Japanese model | DataParallel |
hf_sentiment_analysis | Examples of training Hugging Face bert-base-cased model for a text classification task with Trn1 Single Neuron and Distributed Training | DataParallel |
customop_mlp | Examples of training a multilayer perceptron model with a custom Relu operator on a single Trn1 | DataParallel |
tp_dp_gpt_neox_20b_hf_pretrain | Training GPT-NEOX 20B model using neuronx-distributed | Tensor Parallel & DataParallel |
tp_dp_gpt_neox_6.9b_hf_pretrain | Training GPT-NEOX 6.9B model using neuronx-distributed | Tensor Parallel & DataParallel |
tp_zero1_llama2_7b_hf_pretrain | Training Llama-2 7B model using neuronx-distributed | Tensor Parallel |
tp_pp_llama2_70b_hf_pretrain | Training Llama-2 70B model using neuronx-distributed | Tensor Parallel & Pipeline Parallel |
The following samples are available for inference:
The following samples are available for LLM tensor parallel inference:
Name | Instance type |
---|---|
facebook/opt-13b | Inf2 & Trn1 |
facebook/opt-30b | Inf2 & Trn1 |
facebook/opt-66b | Inf2 |
meta-llama/Llama-2-13b | Inf2 & Trn1 |
The following samples are available for microbenchmarking:
Name | Description |
---|---|
tutorial | Microbenchmarking tutorial |
matmult | Matrix multiplication microbenchmark |