Skip to content

Commit

Permalink
Update PyG notebooks and gradient links
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjsanders277 committed Apr 12, 2023
1 parent b72c8d1 commit 30278aa
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 36 deletions.
6 changes: 5 additions & 1 deletion gnn/cluster_gcn/pytorch_geometric/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Cluster GCN on IPU: Node classification task on a large graph using sampling
# Node Classification on IPU using Cluster-GCN - Training with PyTorch Geometric

In this notebook cluster graph convolutional networks are used for node classification, using cluster sampling. This model has been optimised for Graphcore's IPU.

Run our Cluster GCN training on Paperspace.
<br>
[![Gradient](../../../gradient-badge.svg)](https://ipu.dev/PmAtSw)

| Framework | Domain | Model | Datasets | Tasks | Training | Inference | Reference |
|-----------|--------|-------|----------|-------|----------|-----------|-----------|
| PyTorch | GNNs | CGCN | Reddit | Node Classification | <div style="text-align: center;">✅ <br>Min. 4 IPUs (POD4) required | <p style="text-align: center;">❌ | [Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks](https://arxiv.org/pdf/1905.07953.pdf) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
"id": "361b1074",
"metadata": {},
"source": [
"Cluster GCN on IPU: Node classification task on a large graph using sampling\n",
"Node Classification on IPU using Cluster-GCN - Training with PyTorch Geometric\n",
"==================\n",
"\n",
"This notebook demonstrates training a Cluster GCN model presented in [Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks](https://arxiv.org/pdf/1905.07953.pdf) with PyTorch Geometric on the Graphcore IPU. We will use the Reddit dataset from [Inductive Representation Learning on Large Graphs](https://arxiv.org/abs/1706.02216) and train the model to predict the community a post belongs to.\n",
"\n",
"| Domain | Tasks | Model | Datasets | Workflow | Number of IPUs | Execution time |\n",
"|---------|-------|-------|----------|----------|--------------------|----------------|\n",
"| GNNs | Node Classification | CGCN | Reddit | Training, evaluation | recommended: 4 | 20mn |\n",
"\n",
"This notebook assumes some familiarity with PopTorch as well as PyTorch Geometric (PyG). For additional resources please consult:\n",
"\n",
"* [PopTorch Documentation](https://docs.graphcore.ai/projects/poptorch-user-guide/en/latest/index.html),\n",
Expand Down Expand Up @@ -726,7 +730,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "3.2.0+1262_poptorch",
"display_name": "3.2.0+1277_poptorch",
"language": "python",
"name": "python3"
},
Expand All @@ -740,7 +744,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]"
"version": "3.8.10 (default, Mar 13 2023, 10:26:41) \n[GCC 9.4.0]"
},
"traceability": {
"sdk_version": "3.2.0-EA.1+1249",
Expand All @@ -750,7 +754,7 @@
},
"vscode": {
"interpreter": {
"hash": "4b7133ac454a965c7b25bf17fb22ff5a4b1e3a6d812b3e17a861b05f76606f09"
"hash": "14ed74787bcb3a85d33b99e2a461605961fba8ba6d9ddfcf06c9973f1378dba0"
}
}
},
Expand Down
6 changes: 5 additions & 1 deletion gnn/message_passing/pytorch_geometric/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Molecular property prediction with GIN
# Molecular property prediction on IPU using GIN - Training with PyTorch Geometric

In this notebook a Graph Isomorphism Network (GIN) is used to perform graph classification for molecular property prediction. The model has been optimised for Graphcore's IPU.

Run our GIN training on Paperspace.
<br>
[![Gradient](../../../gradient-badge.svg)](https://ipu.dev/1vOXXi)

| Framework | Domain | Model | Datasets | Tasks | Training | Inference | Reference |
|-----------|--------|-------|----------|-------|----------|-----------|-----------|
| PyTorch | GNNs | GIN | NCI1 | Graph Classification | <div style="text-align: center;">✅ <br>Min. 4 IPUs (POD4) required | <p style="text-align: center;">❌ | [Graph Isomorphism Network](https://arxiv.org/pdf/1810.00826.pdf) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
"id": "d5193627",
"metadata": {},
"source": [
"## Graph Classification with Graph Isomorphism Networks\n",
"## Molecular property prediction on IPU using GIN - Training with PyTorch Geometric\n",
"\n",
"In this tutorial we show an example of how to perform the task of graph classification using the [Graph Isomorphism Network](https://arxiv.org/pdf/1810.00826.pdf) architecture on the Graphcore IPU. This tutorial builds on the [Graph Classification](https://colab.research.google.com/drive/1I8a0DfQ3fI7Njc62__mVXUlcAleUclnb?usp=sharing#scrollTo=1tBMhOrq4JKw) introduction notebook provided by PyTorch Geometric with modifications required in order to use Poptorch. \n",
"\n",
"| Domain | Tasks | Model | Datasets | Workflow | Number of IPUs | Execution time |\n",
"|---------|-------|-------|----------|----------|--------------------|----------------|\n",
"| GNNs | Graph Classification | GIN | NCI1 | Training, evaluation | recommended: 4 | 20mn |\n",
"\n",
"This notebook assumes some familiarity with PopTorch as well as PyTorch Geometric (PyG). For additional resources please consult:\n",
"\n",
"* [PopTorch Documentation](https://docs.graphcore.ai/projects/poptorch-user-guide/en/latest/index.html)\n",
Expand Down Expand Up @@ -767,7 +771,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "3.2.0+1262_poptorch",
"display_name": "3.2.0+1277_poptorch",
"language": "python",
"name": "python3"
},
Expand All @@ -781,7 +785,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]"
"version": "3.8.10 (default, Mar 13 2023, 10:26:41) \n[GCC 9.4.0]"
},
"traceability": {
"sdk_version": "3.2.0-EA.1+1249",
Expand All @@ -791,7 +795,7 @@
},
"vscode": {
"interpreter": {
"hash": "4b7133ac454a965c7b25bf17fb22ff5a4b1e3a6d812b3e17a861b05f76606f09"
"hash": "14ed74787bcb3a85d33b99e2a461605961fba8ba6d9ddfcf06c9973f1378dba0"
}
}
},
Expand Down
8 changes: 6 additions & 2 deletions gnn/nbfnet/pytorch_geometric/NBFNet_training.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@
"id": "73b4dca6-3257-4709-aac0-9ae6441216aa",
"metadata": {},
"source": [
"# Training Neural Bellman-Ford networks (NBFnet) for inductive knowledge graph link prediction on IPUs\n",
"# Training Neural Bellman-Ford networks (NBFnet) for inductive knowledge graph link prediction on IPUs \n",
"\n",
"<a href=\"https://arxiv.org/abs/2106.06935\" target=\"_blank\">Neural Bellman-Ford networks (NBFNet)</a> is a model that generalises path-based reasoning models for predicting links in homogeneous and heterogeneous graphs. \n",
"\n",
"In this notebook we use NBFNet for link prediction in the FB15k-237 knowledge graph with 14541 entities, 237 relation types and 272115 triples. However in practice we explicitly insert reverse edges, which brings us to a total of 474 relation types and 544230 triples.\n",
"\n",
"Unlike many other knowledge graph completion models, NBFNet can be *inductive*, in other words it can generalise to entities that do not appear in the training data. To demonstrate this inductive behaviour we train the model on a small subset of the graph (4707 entities, 54406 triples) and perform inference on the complete FB15k-237 graph.\n",
"\n",
"| Domain | Tasks | Model | Datasets | Workflow | Number of IPUs | Execution time |\n",
"|---------|-------|-------|----------|----------|--------------------|----------------|\n",
"| GNNs | Link Prediction | NBFNet | FB15k-237 | Training, evaluation | recommended: 16 (min: 4) | 20mn |\n",
"\n",
"This notebook assumes some familiarity with PopTorch as well as PyTorch Geometric (PyG). For additional resources please consult:\n",
"* [PopTorch Documentation](https://docs.graphcore.ai/projects/poptorch-user-guide/en/latest/index.html),\n",
"* [PopTorch Examples and Tutorials](https://docs.graphcore.ai/en/latest/examples.html#pytorch),\n",
Expand Down Expand Up @@ -617,7 +621,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]"
"version": "3.8.10 (default, Mar 13 2023, 10:26:41) \n[GCC 9.4.0]"
},
"pycharm": {
"stem_cell": {
Expand Down
4 changes: 2 additions & 2 deletions gnn/nbfnet/pytorch_geometric/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# NBFNet: Neural Bellman-Ford Networks
# Training Neural Bellman-Ford networks (NBFnet) for inductive knowledge graph link prediction on IPUs

This directory contains a PyTorch Geometric implementation of [NBFNet](https://arxiv.org/abs/2106.06935) used for link
prediction in homogeneous and heterogeneous graphs. The model has been optimised for Graphcore's IPU.

Run inductive training on the FB15k-237 knowledge graph on Paperspace.
<br>
[![Gradient](../../../gradient-badge.svg)](TODO)
[![Gradient](../../../gradient-badge.svg)](https://ipu.dev/EzpMQD)

| Framework | Domain | Model | Datasets | Tasks | Training | Inference | Reference |
|-----------|--------|-------|----------|-------|----------|-----------|-----------|
Expand Down
6 changes: 5 additions & 1 deletion gnn/schnet/pytorch_geometric/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Molecular property prediction with SchNet
# Molecular property prediction on IPU using SchNet - Training with PyTorch Geometric

In this notebook an SchNet GNN is used to perform graph classification for molecular property prediction. The model has been optimised for Graphcore's IPU.

Run our SchNet training on Paperspace.
<br>
[![Gradient](../../../gradient-badge.svg)](https://ipu.dev/zUl8uW)

| Framework | Domain | Model | Datasets | Tasks | Training | Inference | Reference |
|-----------|--------|-------|----------|-------|----------|-----------|-----------|
| PyTorch | GNNs | SchNet | QM9 | Graph Classification | <div style="text-align: center;">✅ <br>Min. 4 IPUs (POD4) required | <p style="text-align: center;">❌ | [SchNet graph neural network](https://arxiv.org/abs/1712.06113) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@
"id": "3e1fbc52",
"metadata": {},
"source": [
"Prediction of Molecular Properties using SchNet on Graphcore IPUs\n",
"Molecular property prediction on IPU using SchNet - Training with PyTorch Geometric\n",
"=================================================================\n",
"\n",
"This notebook demonstrates training a [SchNet graph neural network](https://arxiv.org/abs/1712.06113) with PyTorch Geometric on the Graphcore IPU. We will use the QM9 dataset from the [MoleculeNet: A Benchmark for Molecular\n",
" Machine Learning](https://arxiv.org/abs/1703.00564) paper and train the SchNet model to predict the HOMO-LUMO energy gap.\n",
"\n",
"| Domain | Tasks | Model | Datasets | Workflow | Number of IPUs | Execution time |\n",
"|---------|-------|-------|----------|----------|--------------------|----------------|\n",
"| GNNs | Graph Classification | SchNet | QM9 | Training, evaluation | recommended: 16 (min: 4) | 20mn |\n",
"\n",
"This notebook assumes some familiarity with PopTorch as well as PyTorch Geometric (PyG). For additional resources please consult:\n",
"\n",
"* [PopTorch Documentation](https://docs.graphcore.ai/projects/poptorch-user-guide/en/latest/index.html)\n",
Expand Down Expand Up @@ -943,7 +947,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "3.2.0+1262_poptorch",
"display_name": "3.2.0+1277_poptorch",
"language": "python",
"name": "python3"
},
Expand All @@ -957,7 +961,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]"
"version": "3.8.10 (default, Mar 13 2023, 10:26:41) \n[GCC 9.4.0]"
},
"traceability": {
"sdk_version": "3.2.0-EA.1+1249",
Expand All @@ -967,7 +971,7 @@
},
"vscode": {
"interpreter": {
"hash": "4b7133ac454a965c7b25bf17fb22ff5a4b1e3a6d812b3e17a861b05f76606f09"
"hash": "14ed74787bcb3a85d33b99e2a461605961fba8ba6d9ddfcf06c9973f1378dba0"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions gnn/tgn/pytorch/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Temporal Graph Networks
# Training dynamic graphs on IPU using Temporal Graph Networks (TGN)

Temporal graph networks for link prediction in dynamic graphs, based on [`examples/tgn.py`](https://github.com/rusty1s/pytorch_geometric/blob/master/examples/tgn.py) from PyTorch-Geometric, optimised for Graphcore's IPU.

Run our TGN on paperspace.
<br>
[![Gradient](../../../gradient-badge.svg)](https://ipu.dev/3CG1WqL)
[![Gradient](../../../gradient-badge.svg)](https://ipu.dev/jffnhe)

| Framework | Domain | Model | Datasets | Tasks | Training | Inference | Reference |
|-----------|--------|-------|----------|-------|----------|-----------|-----------|
Expand Down
8 changes: 7 additions & 1 deletion gnn/tgn/pytorch/Train_TGN.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "c820e409-be83-40ba-b93e-83f7d82d1227",
"metadata": {
"tags": []
},
"source": [
"# Temporal Graph Networks training\n",
"# Training dynamic graphs on IPU using Temporal Graph Networks (TGN)\n",
"\n",
"This notebook demonstrates how to train [Temporal Graph Networks](https://arxiv.org/abs/2006.10637)\n",
"(TGNs) on the IPU. See our [blog post](https://www.graphcore.ai/posts/accelerating-and-scaling-temporal-graph-networks-on-the-graphcore-ipu) for details on\n",
"performance and scaling.\n",
"TGN can be used to predict connections in a dynamically evolving graph. This application looks at graphs that gain edges over time. A typical use case is a social network where users form new connections over time, or a recommendation system where new edges represent an interaction of a user with a product or content.\n",
"\n",
"| Domain | Tasks | Model | Datasets | Workflow | Number of IPUs | Execution time |\n",
"|---------|-------|-------|----------|----------|--------------------|----------------|\n",
"| GNNs | Link Prediction | TGN | JODIE | Training, evaluation | recommended: 4 | 20mn |\n",
"\n",
"![dynamic_graph.png](static/dynamic_graph.png)\n",
"\n",
"In this notebook we apply TGN to the [JODIE Wikipedia dataset](https://snap.stanford.edu/jodie/), a dynamic graph of 1,000 Wikipedia articles and 8,227 Wikipedia users. 157,474 time-stamped edges describe the interactions of users with articles."
Expand Down
2 changes: 1 addition & 1 deletion tutorials/tutorials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Running a Hugging Face model on the IPU:

- [Fine-tuning a HuggingFace Vision Transformer (ViT) on the IPU Using a Local Dataset](pytorch/vit_model_training)

## PyTorch Geometric [![Gradient](../../gradient-badge.svg)](TODO)
## PyTorch Geometric [![Gradient](../../gradient-badge.svg)](https://ipu.dev/RfTOyI)

Getting started:

Expand Down
Loading

0 comments on commit 30278aa

Please sign in to comment.