examples icon indicating copy to clipboard operation
examples copied to clipboard

Example code and applications for machine learning on Graphcore IPUs

Graphcore Application examples

This repository contains a catalogue of application examples that have been optimised to run on Graphcore IPUs for both training and inference. Access reproducible code for a wide range of popular models covering NLP, Computer Vision, Speech, Multimodal, GNNs, AI for Simulation, Recommender Systems, and more. This includes a selection of models that achieve state of the art performance on IPUs, as well as code examples for self-learning.

Run models out-the-box on IPUs integrated with popular ML frameworks and libraries:

Snip 2022-07-05 20 04 06

To see what's new and easily filter applications by domain and framework, please check out our Model Garden :tulip:.

For more detailed benchmark information, please visit our Performance Results page.

The code presented here requires using Poplar SDK 2.6.x

Please install and enable the Poplar SDK following the instructions in the Getting Started guide for your IPU system.

If you require POD128/256 setup and configuration for our applications, please contact our engineering support.

Repository contents

  1. Computer Vision
  2. Natural Language Processing
  3. Speech
  4. Multimodal
  5. Graph Neural Network
  6. AI for Simulation
  7. Recommender Systems
  8. Reinforcement Learning
  9. Sparsity
  10. Probability
  11. Miscellaneous
  12. Archived

Computer Vision

Model Domain Type Links
ResNet Image Classification Training & Inference TensorFlow 1 , TensorFlow 2, PyTorch, PyTorch Lightning
ResNeXt Image Classification Training & Inference TensorFlow 1 , PopART (Inference)
EfficientNet Image Classification Training & Inference TensorFlow 1 , PyTorch, PyTorch Lightning
MobileNet Image Classification Inference TensorFlow 1
MobileNetv2 Image Classification Inference TensorFlow 1
MobileNetv3 Image Classification Training & Inference PyTorch
ViT(Vision Transformer) Image Classification Training PyTorch, Hugging Face Optimum
DINO Image Classification Training PyTorch
Swin Image Classification Training PyTorch
Yolov3 Object Detection Training & Inference TensorFlow 1
Yolov4-P5 Object Detection Inference PyTorch
Faster RCNN Object Detection Training & Inference PopART
EfficientDet Object Detection Inference TensorFlow 2
SSD Object Detection Inference TensorFlow 1
UNet (Medical) Image segmentation Training & Inference TensorFlow 2
UNet (Industrial) Image segmentation Training TensorFlow 1
Neural Image Fields Neural Radiance Fields Training TensorFlow 2

Natural Language Processing

Model Domain Type Links
BERT NLP Training & Inference TensorFlow 1 , PyTorch , PopART, TensorFlow 2, PopXL, PaddlePaddle, Hugging Face Optimum
Group BERT NLP Training TensorFlow 1
Packed BERT NLP Training PyTorch, PopART
GPT2 NLP Training PyTorch , Hugging Face Optimum
RoBERTa NLP Training Hugging Face Optimum
DeBERTa NLP Training Hugging Face Optimum
HuBERT NLP Training Hugging Face Optimum
BART NLP Training Hugging Face Optimum
T5 NLP Training Hugging Face Optimum

Speech

Model Domain Type Links
DeepVoice3 TTS (TextToSpeech) Training & Inference PopART
FastSpeech2 TTS(TextToSpeech) Training & Inference TensorFlow 2
Fastpitch TTS (TextToSpeech) Training PyTorch
Conformer STT(SpeechToText) Training & Inference PopART, TensorFlow 1, PyTorch
Transfomer Transducer STT(SpeechToText) Training & Inference PopART
Wav2Vec2 STT(SpeechToText) Training Hugging Face Optimum

Multimodal

Model Domain Type Links
miniDALL-E multimodal Training PyTorch
CLIP multimodal Training PyTorch
LXMERT multimodal Training Hugging Face Optimum

Graph Neural Network

Model Domain Type Links
TGN (Temporal Graph Network) GNN Training & Inference TensorFlow 1
MPNN (Message Passing Neural Networks) GNN Training & Inference TensorFlow 2
Spektral GNN library with QM9 GNN Training TensorFlow 2
Cluster GCN GNN Training & Inference TensorFlow 2

AI for Simulation

Model Domain Type Links
DeepDriveMD Biology (Protein folding) Training TensorFlow 2
CosmoFlow example using 3D Convolutions Cosmology Training & Inference TensorFlow 1
et0 Evapotransporation Inference TensorFlow 1
Approximate Bayesian Computation (ABC) COVID-19 Medical Inference TensorFlow 2

Recommender Systems

Model Domain Type Links
Deep AutoEncoders for Collaborative Filtering Recommender Systems Training & Inference TensorFlow 1
Click through rate: Deep Interest Network Recommender Systems Training & Inference TensorFlow 1

Reinforcement Learning

Model Domain Type Links
RL Policy model Reinforcement Learning Training TensorFlow 1

Sparsity

Model Domain Type Links
MNIST RigL Dynamic Sparsity Training TensorFlow 1
Autoregressive Language Modelling Dynamic Sparsity Training TensorFlow 1
Block-Sparse library Sparsity Training & Inference PopART , TensorFlow 1

Probability

Model Domain Type Links
Contrastive Divergence VAE using MCMC methods Generative Model Training TensorFlow 1
mcmc Statistics Training & Inference TensorFlow 1

Miscellaneous

Model Domain Type Links
Sales forecasting MLP (Multi-Layer Perceptron) Training TensorFlow 1
Monte Carlo Ray Tracing Graphics Inference Poplar

Archived

The following applications have been archived. More information can be provided on request.

Model Domain Type Framework
Minigo Reinforcement Learning Training TensorFlow 1

Developer Resources

  • Documentation: Explore our software documentation, user guides, and technical notes
  • Tutorials: Hands-on code tutorials, simple application and feature examples
  • How-to Videos: Watch practical how-to videos and demos by Graphcore engineers
  • Research Papers: Read publications from Graphcore's Research team and IPU innovators

PopVision™ Tools

Visualise your code's inner workings with a user-friendly, graphical interface to optimise your machine learning models.

Download PopVision to analyse IPU performance and utilisation.


Support

Please note we are not currently accepting pull requests or issues on this repository. If you are actively using this repository and want to report any issues, please raise a ticket through the Graphcore support portal.


Utilities

The utils/ folder contains utilities libraries and scripts that are used across the other code examples. This includes:

  • utils/examples_tests - Common Python helper functions for the repository's unit tests
  • utils/benchmarks - Common Python helper functions for running benchmarks on the IPU in different frameworks

License

Unless otherwise specified by a LICENSE file in a subdirectory, the LICENSE referenced at the top level applies to the files in this repository.


Changelog

Aug 2022
  • Change the folder name of models
    • NLP : from gpt to gpt2
    • Speech : from wenet-conformer to conformer
July 2022
  • Major reorganisation of all the apps so that they are arranged as: problem domain / model / framework.
  • Problem domains: Vision, NLP, Speech, GNN, Sparsity, AI for Simultation, Recomender systems, Reinforcement learning, Probability, Multimodal, and Miscellaneous.
  • Added those models below to reference models
    • Vision : Swin (PyTorch) , ViT (Hugging Face Optimum)
    • NLP : GPT2 Small/Medium/Large (PyTorch), BERT-Base/Large (PopXL), BERT-Base(PaddlePaddle), BERT-Base/Large(Hugging Face Optimum), GPT2 Small/Medium (Hugging Face Optimum), RoBERTa Base/Large(Hugging Face Optimum), DeBERTa(Hugging Face Optimum), HuBERT(Hugging Face Optimum), BART(Hugging Face Optimum), T5 small(Hugging Face Optimum)
    • Speech : Fastpitch (PyTorch), WeNet-Conformer-Medium(PyTorch) ,Wav2Vec2(Hugging Face Optimum)
    • Multimodal : CLIP (PyTorch), LXMERT(Hugging Face Optimum)
    • AI for Simulation : et0(TensorFlow 1)
  • Removed Conformer-small/large (PyTorch)
  • Archived Minigo (TensorFlow 1)
May 2022
  • Added those models below to reference models
    • Vision : ViT-pretraining(PyTorch), DINO(PyTorch), EfficientDet-inference(TensorFlow 2), Neural Image Fields (TensorFlow 2)
    • NLP : PackedBERT(PyTorch, PopART), BERT-Large(TensorFlow 2)
    • Speech : FastSpeech2-inference(TensorFlow 2), Conformer-Large(PyTorch)
    • GNN : Cluster GCN(TensorFlow 2)
    • AI for Simulation : DeepDriveMD(TensorFlow 2)
December 2021
  • Added those models below to reference models
    • Vision : miniDALL-E(PyTorch), Faster RCNN(PopART), UNet(TensorFlow 2), ResNet50(TensorFlow 2)
    • NLP : BERT(TensorFlow 2)
    • Speech : FastSpeech2(TensorFlow 2), Transfomer Transducer(PopART), Conformer-Small(PyTorch)
    • GNN : TGN(TensorFlow 1), MPNN(TensorFlow 2)

Connect with us