Skip to content

Commit 97c241f

Browse files
authored
Merge pull request #2 from PaddlePaddle/master
merge
2 parents 711b7bd + 2e3c52a commit 97c241f

File tree

209 files changed

+21930
-820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+21930
-820
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
sha: 5bf6c09bfa1297d3692cadd621ef95f1284e33c0
2424
hooks:
2525
- id: check-added-large-files
26-
args: [--maxkb=1024]
26+
args: [--maxkb=4096]
2727
- id: check-merge-conflict
2828
- id: check-symlinks
2929
- id: detect-private-key

README.md

+73-18
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
# Paddle Graph Learning (PGL)
1+
<img src="./docs/source/_static/logo.png" alt="The logo of Paddle Graph Learning (PGL)" width="320">
22

3-
[DOC](https://pgl.readthedocs.io/en/latest/) | [Quick Start](https://pgl.readthedocs.io/en/latest/instruction.html)
3+
[DOC](https://pgl.readthedocs.io/en/latest/) | [Quick Start](https://pgl.readthedocs.io/en/latest/quick_start/instruction.html) | [中文](./README.zh.md)
44

5-
Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based on [PaddlePaddle](https://github.com/PaddlePaddle/Paddle).
5+
Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based on [PaddlePaddle](https://github.com/PaddlePaddle/Paddle).
66

77

8-
<img src="https://github.com/PaddlePaddle/PGL/blob/master/docs/source/_static/framework_of_pgl.png" alt="The Framework of Paddle Graph Learning (PGL)" width="800">
8+
<img src="./docs/source/_static/framework_of_pgl.png" alt="The Framework of Paddle Graph Learning (PGL)" width="800">
99

1010

11-
We provide python interfaces for storing/reading/querying graph structured data and two fundamental computational interfaces, which are walk based paradigm and message-passing based paradigm as shown in the above framework of PGL, for building cutting-edge graph learning algorithms. 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.
11+
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.
1212

1313

14-
## Highlight: Efficient and Flexible Message Passing Paradigm
14+
## Highlight: Efficiency - Support Scatter-Gather and LodTensor Message Passing
1515

1616
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](https://github.com/dmlc/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 ![](http://latex.codecogs.com/gif.latex?\\phi^e}) to send the message from the source to the target node. For the second step, the recv function ![](http://latex.codecogs.com/gif.latex?\\phi^v}) is responsible for aggregating ![](http://latex.codecogs.com/gif.latex?\\oplus}) messages together from different sources.
1717

1818

1919

20-
<img src="https://github.com/PaddlePaddle/PGL/blob/master/docs/source/_static/message_passing_paradigm.png" alt="The basic idea of message passing paradigm" width="800">
20+
<img src="./docs/source/_static/message_passing_paradigm.png" alt="The basic idea of message passing paradigm" width="800">
2121

22-
As shown in the left of the following figure, to adapt general user-defined message aggregate functions, DGL uses the degree bucketing method to combine nodes with the same degree into a batch and then apply an aggregate function ![](http://latex.codecogs.com/gif.latex?\\oplus}) on each batch serially. For our PGL UDF aggregate function, we organize the message as a [LodTensor](http://www.paddlepaddle.org/documentation/docs/en/1.4/user_guides/howto/basic_concept/lod_tensor_en.html) in [PaddlePaddle](https://github.com/PaddlePaddle/Paddle) taking the message as variable length sequences. And we **utilize the features of LodTensor in Paddle to obtain fast parallel aggregation**.
22+
As shown in the left of the following figure, to adapt general user-defined message aggregate functions, DGL uses the degree bucketing method to combine nodes with the same degree into a batch and then apply an aggregate function ![](http://latex.codecogs.com/gif.latex?\\oplus}) on each batch serially. For our PGL UDF aggregate function, we organize the message as a [LodTensor](http://www.paddlepaddle.org/documentation/docs/en/1.4/user_guides/howto/basic_concept/lod_tensor_en.html) in [PaddlePaddle](https://github.com/PaddlePaddle/Paddle) taking the message as variable length sequences. And we **utilize the features of LodTensor in Paddle to obtain fast parallel aggregation**.
2323

2424

25-
<img src="https://github.com/PaddlePaddle/PGL/blob/master/docs/source/_static/parallel_degree_bucketing.png" alt="The parallel degree bucketing of PGL" width="800">
25+
<img src="./docs/source/_static/parallel_degree_bucketing.png" alt="The parallel degree bucketing of PGL" width="800">
2626

2727

2828
Users only need to call the ```sequence_ops``` functions provided by Paddle to easily implement efficient message aggregation. For examples, using ```sequence_pool``` to sum the neighbor message.
@@ -33,14 +33,14 @@ Users only need to call the ```sequence_ops``` functions provided by Paddle to e
3333
```
3434

3535

36-
Although DGL does some kernel fusion optimization for general sum, max and other aggregate functions with scatter-gather. For **complex user-defined functions** with degree bucketing algorithm, the serial execution for each degree bucket cannot take full advantage of the performance improvement provided by GPU. However, operations on the PGL LodTensor-based message is performed in parallel, which can fully utilize GPU parallel optimization. Even without scatter-gather optimization, PGL still has excellent performance. Of course, we still provide build-in scatter-optimized message aggregation functions.
36+
Although DGL does some kernel fusion optimization for general sum, max and other aggregate functions with scatter-gather. For **complex user-defined functions** with degree bucketing algorithm, the serial execution for each degree bucket cannot take full advantage of the performance improvement provided by GPU. However, operations on the PGL LodTensor-based message is performed in parallel, which can fully utilize GPU parallel optimization. In our experiments, PGL can reach up to 13 times the speed of DGL with complex user-defined functions. Even without scatter-gather optimization, PGL still has excellent performance. Of course, we still provide build-in scatter-optimized message aggregation functions.
3737

38-
## Performance
38+
### Performance
3939

4040

41-
We test all the GNN algorithms with Tesla V100-SXM2-16G running for 200 epochs to get average speeds. And we report the accuracy on test dataset without early stoppping.
41+
We test all the following GNN algorithms with Tesla V100-SXM2-16G running for 200 epochs to get average speeds. And we report the accuracy on test dataset without early stoppping.
4242

43-
| Dataset | Model | PGL Accuracy | PGL speed (epoch time) | DGL speed (epoch time) |
43+
| Dataset | Model | PGL Accuracy | PGL speed (epoch time) | DGL 0.3.0 speed (epoch time) |
4444
| -------- | ----- | ----------------- | ------------ | ------------------------------------ |
4545
| Cora | GCN |81.75% | 0.0047s | **0.0045s** |
4646
| Cora | GAT | 83.5% | **0.0119s** | 0.0141s |
@@ -49,12 +49,64 @@ We test all the GNN algorithms with Tesla V100-SXM2-16G running for 200 epochs t
4949
| Citeseer | GCN |70.2%| **0.0045** |0.0046s|
5050
| Citeseer | GAT |68.8%| **0.0124s** |0.0139s|
5151

52+
53+
If we use complex user-defined aggregation like [GraphSAGE-LSTM](https://cs.stanford.edu/people/jure/pubs/graphsage-nips17.pdf) that aggregates neighbor features with LSTM ignoring the order of recieved messages, the optimized message-passing in DGL will be forced to degenerate into degree bucketing scheme. The speed performance will be much slower than the one implemented in PGL. Performances may be various with different scale of the graph, in our experiments, PGL can reach up to 13 times the speed of DGL.
54+
55+
| Dataset | PGL speed (epoch time) | DGL 0.3.0 speed (epoch time) | Speed up|
56+
| -------- | ------------ | ------------------------------------ |----|
57+
| Cora | **0.0186s** | 0.1638s | 8.80x|
58+
| Pubmed | **0.0388s** |0.5275s | 13.59x|
59+
| Citeseer | **0.0150s** | 0.1278s | 8.52x |
60+
61+
## Highlight: Flexibility - Natively Support Heterogeneous Graph Learning
62+
63+
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.
64+
65+
### Support meta path walk sampling on heterogeneous graph
66+
67+
<img src="./docs/source/_static/metapath_sampling.png" alt="The metapath sampling in heterogeneous graph" width="800">
68+
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
69+
<img src="./docs/source/_static/metapath_result.png" alt="The metapath result" width="320">
70+
Then on this basis, and introducing word2vec and other methods to support learning metapath2vec and other algorithms of heterogeneous graph representation.
71+
72+
### Support Message Passing mechanism on heterogeneous graph
73+
74+
<img src="./docs/source/_static/him_message_passing.png" alt="The message passing mechanism on heterogeneous graph" width="800">
75+
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.
76+
77+
78+
## Large-Scale: Support distributed graph storage and distributed training algorithms
79+
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](https://github.com/PaddlePaddle/Fleet) 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.
80+
81+
<img src="./docs/source/_static/distributed_frame.png" alt="The distributed frame of PGL" width="800">
82+
83+
84+
## Model Zoo
85+
The following are 13 graph learning models that have been implemented in the framework. See the details [here](https://pgl.readthedocs.io/en/latest/introduction.html#highlight-tons-of-models)
86+
87+
|Model | feature |
88+
|---|---|
89+
| GCN | Graph Convolutional Neural Networks |
90+
| GAT | Graph Attention Network |
91+
| GraphSage |Large-scale graph convolution network based on neighborhood sampling|
92+
| unSup-GraphSage | Unsupervised GraphSAGE |
93+
| LINE | Representation learning based on first-order and second-order neighbors |
94+
| DeepWalk | Representation learning by DFS random walk |
95+
| MetaPath2Vec | Representation learning based on metapath |
96+
| Node2Vec | The representation learning Combined with DFS and BFS |
97+
| Struct2Vec | Representation learning based on structural similarity |
98+
| SGC | Simplified graph convolution neural network |
99+
| GES | The graph represents learning method with node features |
100+
| DGI | Unsupervised representation learning based on graph convolution network |
101+
| GATNE | Representation Learning of Heterogeneous Graph based on MessagePassing |
102+
103+
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.
104+
52105
## System requirements
53106

54107
PGL requires:
55108

56-
* paddle >= 1.5
57-
* networkx
109+
* paddle >= 1.6
58110
* cython
59111

60112

@@ -63,15 +115,18 @@ PGL supports both Python 2 & 3
63115

64116
## Installation
65117

66-
pip install pgl
67-
68-
118+
You can simply install it via pip.
69119

120+
```sh
121+
pip install pgl
122+
```
70123

71124
## The Team
72125

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

128+
E-mail: nlp-gnn[at]baidu.com
129+
75130
## License
76131

77132
PGL uses Apache License 2.0.

0 commit comments

Comments
 (0)