/examples

Example code and applications for machine learning on Graphcore IPUs

Primary LanguagePythonMIT LicenseMIT

Graphcore code examples

This repository contains sample applications and code examples for use with Graphcore IPUs.

If you are interested in finding out more about Graphcore, including getting preview access to IPUs to run these examples, please register your interest here

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: https://www.graphcore.ai/support.

The latest version of the documentation for the Poplar software stack, and other developer resources, is available at https://www.graphcore.ai/developer.

The code presented here requires using Poplar SDK 2.5.x

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

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

Repository contents

  1. Computer Vision
  2. Natural Language Processing
  3. Speech
  4. Graph Neural Network
  5. AI for Simulation
  6. Recommender Systems
  7. Miscellaneous

Computer Vision

Model Domain Type Links
ResNet Image Classification Training & Inference TensorFlow 1 , TensorFlow 2, PyTorch
ResNeXt Image Classification Training & Inference TensorFlow 1 , PopART (Inference)
EfficientNet Image Classification Training & Inference TensorFlow 1 , PyTorch
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
DINO 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
miniDALL-E Generative model in Vision Training & Inference PyTorch
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
Group BERT NLP Training TensorFlow 1
Packed BERT NLP Training PyTorch, PopART

Speech

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

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

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
Click through rate: Deep Interest Evolution Network Recommender Systems Training & Inference TensorFlow 1

Miscellaneous

Model Domain Type Links
RL Policy model Reinforcement Learning Training TensorFlow 1
MNIST RigL Dynamic Sparsity Training TensorFlow 1
Autoregressive Language Modelling Dynamic Sparsity Training TensorFlow 1
Block-Sparse library Sparsity Training & Inference PopART , TensorFlow 1
Sales forecasting MLP (Multi-Layer Perceptron) Training TensorFlow 1
Contrastive Divergence VAE using MCMC methods Generative Model Training TensorFlow 1
Monte Carlo Ray Tracing Vision Inference Poplar
mcmc Statistics Training & Inference TensorFlow 1
Approximate Bayesian Computation (ABC) COVID-19 Medical Inference TensorFlow 2


Glossary


Application examples

The applications/ folder contains example applications written in different frameworks targeting the IPU. See the READMEs in each folder for details on how to use these applications.

Code examples

The code_examples/ folder contains smaller models and code examples. See the READMEs in each folder for details.

Tutorials

Tutorials and further code examples can be found in our dedicated Tutorials repository.

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.


Changelog

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)