未验证 提交 496d4d30 编写于 作者: W Weiyue Su 提交者: GitHub

Merge pull request #60 from Yelrose/master

Update README
<img src="./docs/source/_static/logo.png" alt="The logo of Paddle Graph Learning (PGL)" width="320"> <img src="./docs/source/_static/logo.png" alt="The logo of Paddle Graph Learning (PGL)" width="320">
[![PyPi Latest Release](https://img.shields.io/pypi/v/pgl.svg)](https://pypi.org/project/pgl/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](./LICENSE)
[DOC](https://pgl.readthedocs.io/en/latest/) | [Quick Start](https://pgl.readthedocs.io/en/latest/quick_start/instruction.html) | [中文](./README.zh.md) [DOC](https://pgl.readthedocs.io/en/latest/) | [Quick Start](https://pgl.readthedocs.io/en/latest/quick_start/instruction.html) | [中文](./README.zh.md)
## Breaking News !!
PGL v1.1 2020.4.29
- You can find **ERNIESage**, a novel model for modeling text and graph structures, and its introduction [here](./examples/erniesage/).
- PGL for [Open Graph Benchmark](https://github.com/snap-stanford/ogb) examples can be find [here](./ogb_examples/).
- We add newly graph level operators like **GraphPooling** and [**GraphNormalization**](https://arxiv.org/abs/2003.00982) for graph level predictions.
- We relase a PGL-KE toolkit [here](./examples/pgl-ke) 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](https://github.com/PaddlePaddle/Paddle). Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based on [PaddlePaddle](https://github.com/PaddlePaddle/Paddle).
<img src="./docs/source/_static/framework_of_pgl.png" alt="The Framework of Paddle Graph Learning (PGL)" width="800"> <img src="./docs/source/_static/framework_of_pgl_en.png" alt="The Framework of Paddle Graph Learning (PGL)" width="800">
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. 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.
...@@ -82,10 +99,11 @@ In most cases of large-scale graph learning, we need distributed graph storage a ...@@ -82,10 +99,11 @@ In most cases of large-scale graph learning, we need distributed graph storage a
## Model Zoo ## Model Zoo
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) The following graph learning models have been implemented in the framework. You can find more [examples](./examples) and the [details](https://pgl.readthedocs.io/en/latest/introduction.html#highlight-tons-of-models)
|Model | feature | |Model | feature |
|---|---| |---|---|
| [**ERNIESage**](./examples/erniesage/) | ERNIE SAmple aggreGatE for Text and Graph |
| GCN | Graph Convolutional Neural Networks | | GCN | Graph Convolutional Neural Networks |
| GAT | Graph Attention Network | | GAT | Graph Attention Network |
| GraphSage |Large-scale graph convolution network based on neighborhood sampling| | GraphSage |Large-scale graph convolution network based on neighborhood sampling|
......
<img src="./docs/source/_static/logo.png" alt="The logo of Paddle Graph Learning (PGL)" width="320"> <img src="./docs/source/_static/logo.png" alt="The logo of Paddle Graph Learning (PGL)" width="320">
[![PyPi Latest Release](https://img.shields.io/pypi/v/pgl.svg)](https://pypi.org/project/pgl/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](./LICENSE)
[文档](https://pgl.readthedocs.io/en/latest/) | [快速开始](https://pgl.readthedocs.io/en/latest/quick_start/instruction.html) | [English](./README.md) [文档](https://pgl.readthedocs.io/en/latest/) | [快速开始](https://pgl.readthedocs.io/en/latest/quick_start/instruction.html) | [English](./README.md)
## 最新消息
PGL v1.1 2020.4.29
- **ERNIESage**是PGL团队最新提出的模型,可以用于建模文本以及图结构信息。你可以在[这里](./examples/erniesage)看到详细的介绍。
- PGL现在提供[Open Graph Benchmark](https://github.com/snap-stanford/ogb)的一些例子,你可以在[这里](./ogb_examples)找到。
- 新增了图级别的算子包括**GraphPooling**以及[**GraphNormalization**](https://arxiv.org/abs/2003.00982),这样你就能实现更多复杂的图级别分类模型。
- 新增PGL-KE工具包,里面包含许多经典知识图谱图嵌入算法,包括TransE, TransR, RotatE,详情可见[这里](./examples/pgl-ke)
------
Paddle Graph Learning (PGL)是一个基于[PaddlePaddle](https://github.com/PaddlePaddle/Paddle)的高效易用的图学习框架 Paddle Graph Learning (PGL)是一个基于[PaddlePaddle](https://github.com/PaddlePaddle/Paddle)的高效易用的图学习框架
<img src="./docs/source/_static/framework_of_pgl.png" alt="The Framework of Paddle Graph Learning (PGL)" width="800"> <img src="./docs/source/_static/framework_of_pgl.png" alt="The Framework of Paddle Graph Learning (PGL)" width="800">
...@@ -77,10 +94,11 @@ Paddle Graph Learning (PGL)是一个基于[PaddlePaddle](https://github.com/Padd ...@@ -77,10 +94,11 @@ Paddle Graph Learning (PGL)是一个基于[PaddlePaddle](https://github.com/Padd
## 丰富性——覆盖业界大部分图学习网络 ## 丰富性——覆盖业界大部分图学习网络
下列是框架中已经自带实现的十三种图网络学习模型。详情请参考[这里](https://pgl.readthedocs.io/en/latest/introduction.html#highlight-tons-of-models) 下列是框架中部分已经实现的图网络模型,更多的模型在[这里](./examples)可以找到。详情请参考[这里](https://pgl.readthedocs.io/en/latest/introduction.html#highlight-tons-of-models)
| 模型 | 特点 | | 模型 | 特点 |
|---|---| |---|---|
| [**ERNIESage**](./examples/erniesage/) | 能同时建模文本以及图结构的ERNIE SAmple aggreGatE |
| GCN | 图卷积网络 | | GCN | 图卷积网络 |
| GAT | 基于Attention的图卷积网络 | | GAT | 基于Attention的图卷积网络 |
| GraphSage | 基于邻居采样的大规模图卷积网络 | | GraphSage | 基于邻居采样的大规模图卷积网络 |
......
docs/source/_static/logo.png

45.2 KB | W: | H:

docs/source/_static/logo.png

487.0 KB | W: | H:

docs/source/_static/logo.png
docs/source/_static/logo.png
docs/source/_static/logo.png
docs/source/_static/logo.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -53,7 +53,6 @@ place = fluid.CUDAPlace(0) if use_cuda else fluid.CPUPlace() ...@@ -53,7 +53,6 @@ place = fluid.CUDAPlace(0) if use_cuda else fluid.CPUPlace()
# use GraphWrapper as a container for graph data to construct a graph neural network # use GraphWrapper as a container for graph data to construct a graph neural network
gw = pgl.graph_wrapper.GraphWrapper(name='graph', gw = pgl.graph_wrapper.GraphWrapper(name='graph',
place = place,
node_feat=g.node_feat_info()) node_feat=g.node_feat_info())
``` ```
......
...@@ -77,7 +77,6 @@ place = fluid.CPUPlace() ...@@ -77,7 +77,6 @@ place = fluid.CPUPlace()
# create a GraphWrapper as a container for graph data # create a GraphWrapper as a container for graph data
gw = heter_graph_wrapper.HeterGraphWrapper(name='heter_graph', gw = heter_graph_wrapper.HeterGraphWrapper(name='heter_graph',
place = place,
edge_types = g.edge_types_info(), edge_types = g.edge_types_info(),
node_feat=g.node_feat_info(), node_feat=g.node_feat_info(),
edge_feat=g.edge_feat_info()) edge_feat=g.edge_feat_info())
......
...@@ -53,7 +53,6 @@ class GATNE(object): ...@@ -53,7 +53,6 @@ class GATNE(object):
self.gw = heter_graph_wrapper.HeterGraphWrapper( self.gw = heter_graph_wrapper.HeterGraphWrapper(
name="heter_graph", name="heter_graph",
place=place,
edge_types=self.graph.edge_types_info(), edge_types=self.graph.edge_types_info(),
node_feat=self.graph.node_feat_info(), node_feat=self.graph.node_feat_info(),
edge_feat=self.graph.edge_feat_info()) edge_feat=self.graph.edge_feat_info())
......
...@@ -65,7 +65,6 @@ def main(args): ...@@ -65,7 +65,6 @@ def main(args):
with fluid.program_guard(train_program, startup_program): with fluid.program_guard(train_program, startup_program):
gw = pgl.graph_wrapper.GraphWrapper( gw = pgl.graph_wrapper.GraphWrapper(
name="graph", name="graph",
place=place,
node_feat=dataset.graph.node_feat_info()) node_feat=dataset.graph.node_feat_info())
output = pgl.layers.gcn(gw, output = pgl.layers.gcn(gw,
......
...@@ -170,7 +170,7 @@ def main(args): ...@@ -170,7 +170,7 @@ def main(args):
with fluid.program_guard(train_program, startup_program): with fluid.program_guard(train_program, startup_program):
graph_wrapper = pgl.graph_wrapper.GraphWrapper( graph_wrapper = pgl.graph_wrapper.GraphWrapper(
"sub_graph", fluid.CPUPlace(), node_feat=[('feats', [None, 602], np.dtype('float32'))]) "sub_graph", node_feat=[('feats', [None, 602], np.dtype('float32'))])
model_loss, model_acc = build_graph_model( model_loss, model_acc = build_graph_model(
graph_wrapper, graph_wrapper,
num_class=data["num_class"], num_class=data["num_class"],
......
...@@ -44,7 +44,6 @@ def main(args): ...@@ -44,7 +44,6 @@ def main(args):
with fluid.program_guard(train_program, startup_program): with fluid.program_guard(train_program, startup_program):
gw = pgl.graph_wrapper.GraphWrapper( gw = pgl.graph_wrapper.GraphWrapper(
name="graph", name="graph",
place=place,
node_feat=dataset.graph.node_feat_info()) node_feat=dataset.graph.node_feat_info())
output = pgl.layers.gat(gw, output = pgl.layers.gat(gw,
......
...@@ -204,8 +204,8 @@ def main(args): ...@@ -204,8 +204,8 @@ def main(args):
graph_wrapper = pgl.graph_wrapper.GraphWrapper( graph_wrapper = pgl.graph_wrapper.GraphWrapper(
"sub_graph", "sub_graph",
fluid.CPUPlace(),
node_feat=data['graph'].node_feat_info()) node_feat=data['graph'].node_feat_info())
model_loss, model_acc = build_graph_model( model_loss, model_acc = build_graph_model(
graph_wrapper, graph_wrapper,
num_class=data["num_class"], num_class=data["num_class"],
......
...@@ -231,7 +231,6 @@ def main(args): ...@@ -231,7 +231,6 @@ def main(args):
with fluid.program_guard(train_program, startup_program): with fluid.program_guard(train_program, startup_program):
graph_wrapper = pgl.graph_wrapper.GraphWrapper( graph_wrapper = pgl.graph_wrapper.GraphWrapper(
"sub_graph", "sub_graph",
fluid.CPUPlace(),
node_feat=data['graph'].node_feat_info()) node_feat=data['graph'].node_feat_info())
model_loss, model_acc = build_graph_model( model_loss, model_acc = build_graph_model(
......
...@@ -227,7 +227,6 @@ def main(args): ...@@ -227,7 +227,6 @@ def main(args):
with fluid.program_guard(train_program, startup_program): with fluid.program_guard(train_program, startup_program):
graph_wrapper = pgl.graph_wrapper.GraphWrapper( graph_wrapper = pgl.graph_wrapper.GraphWrapper(
"sub_graph", "sub_graph",
fluid.CPUPlace(),
node_feat=data['graph'].node_feat_info()) node_feat=data['graph'].node_feat_info())
model_loss, model_acc = build_graph_model( model_loss, model_acc = build_graph_model(
......
...@@ -49,7 +49,6 @@ def main(args): ...@@ -49,7 +49,6 @@ def main(args):
with fluid.program_guard(train_program, startup_program): with fluid.program_guard(train_program, startup_program):
gw = pgl.graph_wrapper.GraphWrapper( gw = pgl.graph_wrapper.GraphWrapper(
"gw", "gw",
place,
node_feat=[('norm', [None, 1], "float32")], node_feat=[('norm', [None, 1], "float32")],
edge_feat=[('weights', [None, 1], "float32")]) edge_feat=[('weights', [None, 1], "float32")])
......
...@@ -88,7 +88,7 @@ def build_graph_model(args): ...@@ -88,7 +88,7 @@ def build_graph_model(args):
graph_wrappers.append( graph_wrappers.append(
pgl.graph_wrapper.GraphWrapper( pgl.graph_wrapper.GraphWrapper(
"layer_0", fluid.CPUPlace(), node_feat=node_feature_info)) "layer_0", node_feat=node_feature_info))
#edge_feat=[("f", [None, 1], "float32")])) #edge_feat=[("f", [None, 1], "float32")]))
num_embed = args.num_nodes num_embed = args.num_nodes
......
...@@ -477,9 +477,6 @@ class GraphWrapper(BaseGraphWrapper): ...@@ -477,9 +477,6 @@ class GraphWrapper(BaseGraphWrapper):
Args: Args:
name: The graph data prefix name: The graph data prefix
place: fluid.CPUPlace or fluid.CUDAPlace(n) indicating the
device to hold the graph data.
node_feat: A list of tuples that decribe the details of node node_feat: A list of tuples that decribe the details of node
feature tenosr. Each tuple mush be (name, shape, dtype) feature tenosr. Each tuple mush be (name, shape, dtype)
and the first dimension of the shape must be set unknown and the first dimension of the shape must be set unknown
...@@ -518,7 +515,6 @@ class GraphWrapper(BaseGraphWrapper): ...@@ -518,7 +515,6 @@ class GraphWrapper(BaseGraphWrapper):
}) })
graph_wrapper = GraphWrapper(name="graph", graph_wrapper = GraphWrapper(name="graph",
place=place,
node_feat=graph.node_feat_info(), node_feat=graph.node_feat_info(),
edge_feat=graph.edge_feat_info()) edge_feat=graph.edge_feat_info())
...@@ -533,12 +529,11 @@ class GraphWrapper(BaseGraphWrapper): ...@@ -533,12 +529,11 @@ class GraphWrapper(BaseGraphWrapper):
ret = exe.run(fetch_list=[...], feed=feed_dict ) ret = exe.run(fetch_list=[...], feed=feed_dict )
""" """
def __init__(self, name, place, node_feat=[], edge_feat=[]): def __init__(self, name, node_feat=[], edge_feat=[], **kwargs):
super(GraphWrapper, self).__init__() super(GraphWrapper, self).__init__()
# collect holders for PyReader # collect holders for PyReader
self._data_name_prefix = name self._data_name_prefix = name
self._holder_list = [] self._holder_list = []
self._place = place
self.__create_graph_attr_holders() self.__create_graph_attr_holders()
for node_feat_name, node_feat_shape, node_feat_dtype in node_feat: for node_feat_name, node_feat_shape, node_feat_dtype in node_feat:
self.__create_graph_node_feat_holders( self.__create_graph_node_feat_holders(
......
...@@ -44,9 +44,6 @@ class HeterGraphWrapper(object): ...@@ -44,9 +44,6 @@ class HeterGraphWrapper(object):
Args: Args:
name: The heterogeneous graph data prefix name: The heterogeneous graph data prefix
place: fluid.CPUPlace or fluid.CUDAPlace(n) indicating the
device to hold the graph data.
node_feat: A dict of list of tuples that decribe the details of node node_feat: A dict of list of tuples that decribe the details of node
feature tenosr. Each tuple mush be (name, shape, dtype) feature tenosr. Each tuple mush be (name, shape, dtype)
and the first dimension of the shape must be set unknown and the first dimension of the shape must be set unknown
...@@ -85,19 +82,15 @@ class HeterGraphWrapper(object): ...@@ -85,19 +82,15 @@ class HeterGraphWrapper(object):
node_feat=node_feat, node_feat=node_feat,
edge_feat=edges_feat) edge_feat=edges_feat)
place = fluid.CPUPlace()
gw = heter_graph_wrapper.HeterGraphWrapper( gw = heter_graph_wrapper.HeterGraphWrapper(
name='heter_graph', name='heter_graph',
place = place,
edge_types = g.edge_types_info(), edge_types = g.edge_types_info(),
node_feat=g.node_feat_info(), node_feat=g.node_feat_info(),
edge_feat=g.edge_feat_info()) edge_feat=g.edge_feat_info())
""" """
def __init__(self, name, place, edge_types, node_feat={}, edge_feat={}): def __init__(self, name, edge_types, node_feat={}, edge_feat={}, **kwargs):
self.__data_name_prefix = name self.__data_name_prefix = name
self._place = place
self._edge_types = edge_types self._edge_types = edge_types
self._multi_gw = {} self._multi_gw = {}
for edge_type in self._edge_types: for edge_type in self._edge_types:
...@@ -114,7 +107,6 @@ class HeterGraphWrapper(object): ...@@ -114,7 +107,6 @@ class HeterGraphWrapper(object):
self._multi_gw[edge_type] = GraphWrapper( self._multi_gw[edge_type] = GraphWrapper(
name=type_name, name=type_name,
place=self._place,
node_feat=n_feat, node_feat=n_feat,
edge_feat=e_feat) edge_feat=e_feat)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册