User guide

Installation and usage

1. Install the Poplar SDK following the instructions in the Getting Started guide for your IPU system.

  1. Enable the Poplar SDK, create and activate a Python virtualenv and install the PopTorch wheel:

source <path to Poplar installation>/enable.sh
source <path to PopART installation>/enable.sh
python3.8 -m venv .venv
source .venv/bin/activate
pip install wheel
pip install $POPLAR_SDK_ENABLED/../poptorch-*.whl

More details are given in the PyTorch quick start guide.

  1. Pip install BESS-KGE:

pip install git+https://github.com/graphcore-research/bess-kge.git
  1. Import and use:

import besskge

Note

The library has been tested on Poplar SDK 3.3.0+1403, Ubuntu 20.04, Python 3.8.

Getting started

For a walkthrough of the main besskge library functionalities, see our Jupyter notebooks. We recommend the following sequence:

  1. KGE training and inference on the OGBL-BioKG dataset.

  2. Link prediction on the YAGO3-10 dataset.

  3. FP16 weights and compute on the OGBL-WikiKG2 dataset.

Limitations

  • besskge supports distribution for up to 16 IPUs.

  • Storing embeddings in SRAM introduces limitations on the size of the embedding tables, and therefore on the entity count in the knowledge graph. Some (approximate) estimates for these limitations are given in the table below (assuming FP16 for weights and FP32 for gradient accumulation and second order momentum). Notice that the cap will also depend on the batch size and the number of negative samples used.

Embeddings

Optimizer

Gradient accumulation

Max number of entities

(# embedding parameters) on

size

dtype

IPU-POD4

IPU-POD16

100

float16

SGDM

No

3.2M (3.2e8)

13M (1.3e9)

128

float16

Adam

No

2.4M (3.0e8)

9.9M (1.3e9)

256

float16

SGDM

Yes

900K (2.3e8)

3.5M (9.0e8)

256

float16

Adam

No

1.2M (3.0e8)

4.8M (1.2e9)

512

float16

Adam

Yes

375K (1.9e8)

1.5M (7.7e8)

If you get an error message during compilation about the ONNX protobuffer exceeding the maximum size, we recommend saving weights to a file using the poptorch.Options API options._Popart.set("saveInitializersToFile", "my_file.onnx").