Hugging Face and Graphcore partner for IPU-optimized Transformers
Hugging Face and Graphcore Partnership Revolutionizes AI Hardware
In a groundbreaking announcement at the 2021 AI Hardware Summit, Hugging Face unveiled its new Hardware Partner Program, aimed at simplifying the deployment of state-of-the-art Transformer models on cutting-edge AI hardware. Graphcore, the pioneering force behind the Intelligence Processing Unit (IPU), is a founding member of this program, and their collaboration is set to transform the AI landscape.
The Intelligence Processing Unit (IPU)
Graphcore's IPU is a game-changing processor designed specifically for the computational requirements of AI and machine learning. Its unique architecture, featuring fine-grained parallelism, low precision arithmetic, and the ability to handle sparsity, sets it apart from traditional GPUs. The IPU's massively parallel, MIMD architecture, combined with ultra-high bandwidth memory placed adjacent to the processor cores, delivers unparalleled performance and efficiency.
Software Integration and Compatibility
Graphcore's Poplar SDK has been co-designed with the IPU since its inception, ensuring seamless integration with standard machine learning frameworks like PyTorch and TensorFlow. This compatibility allows developers to easily port their models from other compute platforms and take advantage of the IPU's advanced AI capabilities.
Optimizing Transformers for Production
Transformers have revolutionized the field of AI, with models like BERT being widely used in various applications across NLP and beyond. These multi-talented models can perform feature extraction, text generation, sentiment analysis, translation, and many more functions. Hugging Face's Transformers library is downloaded an average of 2 million times every month, with a user base of over 50,000 developers – the fastest ever adoption of an open-source project.
Hugging Face Hardware Partner Program
The Hugging Face Hardware Partner Program connects the ultimate Transformer toolset with today's most advanced AI hardware. Using Optimum, a new open-source library and toolkit, developers can access hardware-optimized models certified by Hugging Face. These models are being developed in collaboration between Graphcore and Hugging Face, with the first IPU-optimized models appearing on Optimum later this year. Ultimately, these will cover a wide range of applications, from vision and speech to translation and text generation.
Plug-and-Play Experience
Hugging Face CEO Clément Delangue emphasized the importance of ease of use, stating, "Developers all want access to the latest and greatest hardware – like the Graphcore IPU, but there's always that question of whether they'll have to learn new code or processes. With Optimum and the Hugging Face Hardware Program, that's just not an issue. It's essentially plug-and-play."
Accelerating State-of-the-Art Models
Prior to the announcement, Graphcore demonstrated the power of the IPU to accelerate state-of-the-art Transformer models with a special Graphcore-optimized implementation of Hugging Face BERT using PyTorch. The dramatic benchmark results for BERT running on a Graphcore system, compared with a comparable GPU-based system, are a tantalizing prospect for anyone currently running the popular NLP model on something other than the IPU.
Unlocking Performance Advantages
Graphcore users will now be able to unlock such performance advantages through the Hugging Face platform, with its elegant simplicity and superlative range of models. Together, Hugging Face and Graphcore are helping even more people to access the power of Transformers and accelerate the AI revolution.
Visit the Hugging Face Hardware Partner Portal
To learn more about Graphcore IPU systems and how to gain access, visit the Hugging Face Hardware Partner portal.
Code Blocks
import torch
import torch.nn as nn
import torch.optim as optim
# Example of a simple neural network
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.fc1 = nn.Linear(5, 10) # input layer (5) -> hidden layer (10)
self.fc2 = nn.Linear(10, 5) # hidden layer (10) -> output layer (5)
def forward(self, x):
x = torch.relu(self.fc1(x)) # activation function for hidden layer
x = self.fc2(x)
return x
# Initialize the network and optimizer
net = Net()
optimizer = optim.SGD(net.parameters(), lr=0.01)
# Example of training the network
for epoch in range(100):
optimizer.zero_grad()
outputs = net(torch.randn(10, 5))
loss = nn.MSELoss()(outputs, torch.randn(10, 5))
loss.backward()
optimizer.step()
# Example of running the network on a Graphcore IPU
python -m torch.distributed.launch --nproc_per_node=8 --nnodes=1 --node_rank=0 --master_addr="localhost" --master_port=12345 train.py
// Example of a simple neural network in C
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// Define the neural network structure
typedef struct {
float weights[10];
float bias[10];
} Layer;
// Define the neural network
typedef struct {
Layer input;
Layer hidden;
Layer output;
} Net;
// Initialize the neural network
void init_net(Net *net) {
// Initialize weights and bias for each layer
for (int i = 0; i < 10; i++) {
net->input.weights[i] = (float)rand() / RAND_MAX;
net->input.bias[i] = (float)rand() / RAND_MAX;
net->hidden.weights[i] = (float)rand() / RAND_MAX;
net->hidden.bias[i] = (float)rand() / RAND_MAX;
net->output.weights[i] = (float)rand() / RAND_MAX;
net->output.bias[i] = (float)rand() / RAND_MAX;
}
}
// Forward pass
void forward(Net *net, float *input) {
// Activation function for hidden layer
for (int i = 0; i < 10; i++) {
net->hidden.weights[i] = fmax(0, net->hidden.weights[i]);
}
}
// Example of training the network
int main() {
Net net;
init_net(&net);
float input[5] = {1, 2, 3, 4, 5};
forward(&net, input);
return 0;
}




