Skip to main content

Paddle Graph Learning

Project description

PyPi Latest Release License

DOC | Quick Start | 中文

Breaking News !!

PGL v2.1 20210202

  • We are now support dygraph version of PaddlePaddle 2.0, and release PGL v2.1.
  • You can find the stable staic version of PGL in the branch "static_stable"

PGL v1.2 2020.11.20

  • The PGL team proposed a new Unified Message Passing Model (UniMP), and achieved the State of the Art on three tasks on the OGB leaderboards. You can find the code here.

  • The PGL team proposed a two-stage recall and ranking model based on ERNIEsage, and won the first place in the TextGraphs-2020 competition co-organized by COLING.

  • The PGL team worked hard to develop an open course of Graph Neural Network (GNN), which will help you getting started with Graph Neural Network in seven days. Details can be found in course.

PGL v1.1 2020.4.29

  • You can find ERNIESage, a novel model for modeling text and graph structures, and its introduction here.

  • PGL for Open Graph Benchmark examples can be found here.

  • We add newly graph level operators like GraphPooling and GraphNormalization for graph level predictions.

  • We relase a PGL-KE toolkit here including classical knowledge graph embedding t algorithms like TransE, TransR, RotatE.


Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based on PaddlePaddle.

The newly released PGL supports heterogeneous graph learning on both walk based paradigm and message-passing based paradigm by providing MetaPath sampling and Message Passing mechanism on heterogeneous graph. Furthermor, The newly released PGL also support distributed graph storage and some distributed training algorithms, such as distributed deep walk and distributed graphsage. Combined with the PaddlePaddle deep learning framework, we are able to support both graph representation learning models and graph neural networks, and thus our framework has a wide range of graph-based applications.

One of the most important benefits of graph neural networks compared to other models is the ability to use node-to-node connectivity information, but coding the communication between nodes is very cumbersome. At PGL we adopt Message Passing Paradigm similar to DGL to help to build a customize graph neural network easily. Users only need to write send and recv functions to easily implement a simple GCN. As shown in the following figure, for the first step the send function is defined on the edges of the graph, and the user can customize the send function to send the message from the source to the target node. For the second step, the recv function is responsible for aggregating messages together from different sources.

To write a sum aggregator, users only need to write the following codes.

    import pgl
    import paddle
    import numpy as np


    num_nodes = 5
    edges = [(0, 1), (1, 2), (3, 4)]
    feature = np.random.randn(5, 100).astype(np.float32)

    g = pgl.Graph(num_nodes=num_nodes,
        edges=edges,
        node_feat={
            "h": feature
        })
    g.tensor()

    def send_func(src_feat, dst_feat, edge_feat):
        return src_feat

    def recv_func(msg):
        return msg.reduce_sum(msg["h"]) 

    msg = g.send(send_func, src_feat=g.node_feat)

    ret = g.recv(recv_func, msg)

Highlight: Flexibility - Natively Support Heterogeneous Graph Learning

Graph can conveniently represent the relation between things in the real world, but the categories of things and the relation between things are various. Therefore, in the heterogeneous graph, we need to distinguish the node types and edge types in the graph network. PGL models heterogeneous graphs that contain multiple node types and multiple edge types, and can describe complex connections between different types.

Support meta path walk sampling on heterogeneous graph

The left side of the figure above describes a shopping social network. The nodes above have two categories of users and goods, and the relations between users and users, users and goods, and goods and goods. The right of the above figure is a simple sampling process of MetaPath. When you input any MetaPath as UPU (user-product-user), you will find the following results Then on this basis, and introducing word2vec and other methods to support learning metapath2vec and other algorithms of heterogeneous graph representation.

Support Message Passing mechanism on heterogeneous graph

Because of the different node types on the heterogeneous graph, the message delivery is also different. As shown on the left, it has five neighbors, belonging to two different node types. As shown on the right of the figure above, nodes belonging to different types need to be aggregated separately during message delivery, and then merged into the final message to update the target node. On this basis, PGL supports heterogeneous graph algorithms based on message passing, such as GATNE and other algorithms.

Large-Scale: Support distributed graph storage and distributed training algorithms

In most cases of large-scale graph learning, we need distributed graph storage and distributed training support. As shown in the following figure, PGL provided a general solution of large-scale training, we adopted PaddleFleet as our distributed parameter servers, which supports large scale distributed embeddings and a lightweighted distributed storage engine so it can easily set up a large scale distributed training algorithm with MPI clusters.

Model Zoo

The following graph learning models have been implemented in the framework. You can find more examples and the details here.

Model feature
ERNIESage ERNIE SAmple aggreGatE for Text and Graph
GCN Graph Convolutional Neural Networks
GAT Graph Attention Network
GraphSage Large-scale graph convolution network based on neighborhood sampling
unSup-GraphSage Unsupervised GraphSAGE
LINE Representation learning based on first-order and second-order neighbors
DeepWalk Representation learning by DFS random walk
MetaPath2Vec Representation learning based on metapath
Node2Vec The representation learning Combined with DFS and BFS
Struct2Vec Representation learning based on structural similarity
SGC Simplified graph convolution neural network
GES The graph represents learning method with node features
DGI Unsupervised representation learning based on graph convolution network
GATNE Representation Learning of Heterogeneous Graph based on MessagePassing

The above models consists of three parts, namely, graph representation learning, graph neural network and heterogeneous graph learning, which are also divided into graph representation learning and graph neural network.

System requirements

PGL requires:

  • paddle >= 2.0.0
  • cython

PGL only supports Python 3

Installation

You can simply install it via pip.

pip install pgl

The Team

PGL is developed and maintained by NLP and Paddle Teams at Baidu

E-mail: nlp-gnn[at]baidu.com

License

PGL uses Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pgl-2.1.4-cp38-cp38-win_amd64.whl (7.9 MB view details)

Uploaded CPython 3.8Windows x86-64

pgl-2.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

pgl-2.1.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.5+ x86-64

pgl-2.1.4-cp37-cp37m-win_amd64.whl (7.9 MB view details)

Uploaded CPython 3.7mWindows x86-64

pgl-2.1.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

pgl-2.1.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.5+ x86-64

pgl-2.1.4-cp37-cp37m-macosx_10_9_intel.whl (8.0 MB view details)

Uploaded CPython 3.7mmacOS 10.9+ Intel (x86-64, i386)

pgl-2.1.4-cp36-cp36m-win_amd64.whl (7.9 MB view details)

Uploaded CPython 3.6mWindows x86-64

pgl-2.1.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.17+ x86-64

pgl-2.1.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.5+ x86-64

pgl-2.1.4-cp36-cp36m-macosx_10_9_intel.whl (7.9 MB view details)

Uploaded CPython 3.6mmacOS 10.9+ Intel (x86-64, i386)

File details

Details for the file pgl-2.1.4-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pgl-2.1.4-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.7

File hashes

Hashes for pgl-2.1.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 377355a5d1035cc7f41f98ef69e3238c903b58debd7a132fb14ccd1e640f1a19
MD5 b1c161a663d2a357170b03d01988ba8f
BLAKE2b-256 5e9b849451c5c5c25531b98f358338a27f877782ea4af6802afce5943d47660f

See more details on using hashes here.

File details

Details for the file pgl-2.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: pgl-2.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/2.7.12

File hashes

Hashes for pgl-2.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 05952ab97c2c822a7e71d466db07617c27d6df5789adf16900b9ecaa17ccec9c
MD5 cc7912ee413846c1b938edfb538898b3
BLAKE2b-256 3a07b4ecc9563ba9513c5ad93621525c684d6d65440b190ae154e123db6e7335

See more details on using hashes here.

File details

Details for the file pgl-2.1.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

  • Download URL: pgl-2.1.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.8, manylinux: glibc 2.5+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/2.7.12

File hashes

Hashes for pgl-2.1.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dedf306329596d2e318399fc80290b18b6a92345440bcaa510a6d06acb707367
MD5 c24195c813e6c5064c5d226ca69ef266
BLAKE2b-256 f121d0cec1e67ad72a8c7a5b5a432c5725d9089a877195c49f5e18c29457d6b0

See more details on using hashes here.

File details

Details for the file pgl-2.1.4-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pgl-2.1.4-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

File hashes

Hashes for pgl-2.1.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f776154cb054b9cc02702fb4141f13314ad4c01de137c25f09b84fcd8872fe62
MD5 5c5662e42478581d2357304a0b764f6c
BLAKE2b-256 b667f5a3791a9c7f56f4e0c47b457dbc99eacfde56ec880f656543915254c967

See more details on using hashes here.

File details

Details for the file pgl-2.1.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: pgl-2.1.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/2.7.12

File hashes

Hashes for pgl-2.1.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7dcc3d8608c976a5c9db906ce02177d824466a9b527717ea84dad9fff8e03e0
MD5 1b684bbdb44bbfa837354c3b0b4220f9
BLAKE2b-256 85b1d24475fd9fa32909d2b15ad3722070793400783f476c6702b5b0fdc33d41

See more details on using hashes here.

File details

Details for the file pgl-2.1.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

  • Download URL: pgl-2.1.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.5+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/2.7.12

File hashes

Hashes for pgl-2.1.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7d38ab5ac116e5bc3e1254a806ec819aeeb7f324ef2e9769578fe3b33cc19503
MD5 9e29567a59b858773df5c2e70b9fe6a6
BLAKE2b-256 4f2af799a4009d82418fb2de16d9c5ef99765df151bd97d368cdb14eb73ed167

See more details on using hashes here.

File details

Details for the file pgl-2.1.4-cp37-cp37m-macosx_10_9_intel.whl.

File metadata

  • Download URL: pgl-2.1.4-cp37-cp37m-macosx_10_9_intel.whl
  • Upload date:
  • Size: 8.0 MB
  • Tags: CPython 3.7m, macOS 10.9+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.6

File hashes

Hashes for pgl-2.1.4-cp37-cp37m-macosx_10_9_intel.whl
Algorithm Hash digest
SHA256 8d36be52e74eefdc9f7931ab0cd9514fa6172441195d7fe84b624e697ae0dc11
MD5 43e08b566179ea2b06571c85b045f07c
BLAKE2b-256 517ee9e090dc618ca71cb9c48fd120bf3d79fbf12fcfb50ddff89523cea2825f

See more details on using hashes here.

File details

Details for the file pgl-2.1.4-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pgl-2.1.4-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.8

File hashes

Hashes for pgl-2.1.4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 6da0cb9d621b1d0fc26193f282e84035f456f302f34375beecda83bd713f8be2
MD5 488b83c4f65cf767df46755ca5101b46
BLAKE2b-256 d35d429c1df20070f63372bd3dbed529572fab8fb15754025ba93d10463706a5

See more details on using hashes here.

File details

Details for the file pgl-2.1.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: pgl-2.1.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/2.7.12

File hashes

Hashes for pgl-2.1.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 03085ac6de44ec4024b5a3518854adb568979db26cfc71f914c7c278a623ea09
MD5 7897ed36ff24d0f5fdc33b779e1efc69
BLAKE2b-256 456258e4dabaaac383024e0ac4f5d5e3b13d60d5866313a74371f7a8ce675140

See more details on using hashes here.

File details

Details for the file pgl-2.1.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

  • Download URL: pgl-2.1.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.5+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/2.7.12

File hashes

Hashes for pgl-2.1.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 768a88ed3795d80f9ce5545bd02a71869f748fad6906343679db55faa9f665eb
MD5 258deb66aa9e28ec1104810ae00da4b7
BLAKE2b-256 9fb62a593e73261d084ff3342307582dd9a688f7c25fa036220f0cae298f8e35

See more details on using hashes here.

File details

Details for the file pgl-2.1.4-cp36-cp36m-macosx_10_9_intel.whl.

File metadata

  • Download URL: pgl-2.1.4-cp36-cp36m-macosx_10_9_intel.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.6m, macOS 10.9+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.8

File hashes

Hashes for pgl-2.1.4-cp36-cp36m-macosx_10_9_intel.whl
Algorithm Hash digest
SHA256 7b9582a82db0c5faa1319cf39ff4f4a86cd4488ce45e30dd331c75e5d7a49df0
MD5 c88100386672543e462cfd482c6294b7
BLAKE2b-256 0e3afe837ac32d3b248b499c7f2f587f54b12b2a440a28df3c946ac558e7965c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page