v0.6.0
This new release includes several improvements on DGL’s documentation, distributed training, and fixes and patches to the user experience and system efficiency.
Documentation
The tutorials have been re-worked in this release to make them more consistent and updated to the latest code base. All tutorials are available for download and can be run locally in Jupyter Notebook.
- For absolute beginners, start with the brand new Blitz Introduction to DGL in 120 minutes.
- For those who are interested in mini-batch training of GNNs, read the Stochastic Training of GNNs tutorials which starts from the basic concepts to code examples.
Thanks to the community efforts, DGL’s user guide is now available in Chinese (https://docs.dgl.ai/en/latest/guide_cn/index.html). Credits to @huaiwen @mlsoar @brookhuang16211 Zhiyu Chen @hhhiddleston @AspirinCode @rewonderful @sleeplessai @kevin-meng @CrawlScript @rr-Yiran Qingbiao Li
Model Examples
We index all the DGL examples by their notable tags (e.g. problem domains, tasks, graph characteristics, etc.) and by their publication time. As DGL codebase evolves quickly and may break some examples, we chose to maintain them by branches, i.e., examples on the master branch work with latest nightly build; stable examples are snapshot to the release branch like 0.6.x.
The release also brings 13 new examples, adding up to 72 models in total:
- MixHop: Higher-Order Graph Convolutional Architectures via Sparsified Neighborhood Mixing: https://github.com/dmlc/dgl/tree/master/examples/pytorch/mixhop (Credits to @xnouhz)
- Self-Attention Graph Pooling: https://github.com/dmlc/dgl/tree/master/examples/pytorch/sagpool (Credits to @lygztq )
- GNN-FiLM: Graph Neural Networks with Feature-wise Linear Modulation: https://github.com/dmlc/dgl/tree/master/examples/pytorch/GNN-FiLM (Credits to @KounianhuaDu )
- TensorFlow implementation of Simplifying Graph Convolutional Networks: https://github.com/dmlc/dgl/tree/master/examples/tensorflow/sgc (Credits to @joshcarty)
- Graph Representation Learning via Hard and Channel-Wise Attention Networks: https://github.com/dmlc/dgl/tree/master/examples/pytorch/hardgat (Credits to @Ericcsr )
- Graph Random Neural Network for Semi-Supervised Learning on Graphs: https://github.com/dmlc/dgl/tree/master/examples/pytorch/grand (Credits to @hengruizhang98 )
- Hierarchical Graph Pooling with Structure Learning: https://github.com/dmlc/dgl/tree/master/examples/pytorch/hgp_sl (Credits to @lygztq )
- Towards Deeper Graph Neural Networks: https://github.com/dmlc/dgl/tree/master/examples/pytorch/dagnn (Credits to @lt610)
- PointNet: Deep Learning on Point Sets for 3D Classification and Segmentation/PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space (part segmentation): https://github.com/dmlc/dgl/tree/master/examples/pytorch/pointcloud/pointnet (Credits to @wcyjames )
- Graph Cross Networks with Vertex Infomax Pooling: https://github.com/dmlc/dgl/tree/master/examples/pytorch/gxn (Credits to @lygztq)
- Neural Graph Collaborative Filtering: https://github.com/dmlc/dgl/tree/master/examples/pytorch/NGCF (Credits to @KounianhuaDu )
- Graph Neural Networks with Convolutional ARMA Filters: https://github.com/dmlc/dgl/tree/master/examples/pytorch/arma (Credits to @xnuohz)
- Link Prediction Based on Graph Neural Networks (SEAL): https://github.com/dmlc/dgl/tree/master/examples/pytorch/seal (Credits to @Smilexuhc )
New APIs & Features
- New API:
set_batch_num_nodes
andset_batch_num_edges
for setting batch information manually. They are useful when users want to transform a batched graph into another or construct a new batched graph by themselves (#2430) - New API:
GraphDataLoader
, a data loader wrapper for graph classification tasks. (#2496) - New API: QM9 dataset. (#2521) (Credits to @xnuohz )
- New API: DGL now allows constructing a
DGLBlock
graph from raw data (viadgl.create_block
) or converting aDGLBlock
to normalDGLGraph
(viadgl.block_to_graph
). They are useful when users wish to transform theDGLBlock
graph produced by data loaders such as reversing the graph for message diffusion instead of message aggregation. (#2555) - New API: A new namespace
dgl.nn.functional
for NN related utilities that are functional, much resemblingtorch.nn.functional
.edge_softmax
is moved there. The olddgl.ops.edge_softmax
is deprecated. (#2442) - New Feature: Support mixed precision training. DGL now supports training with half precision and thus is compatible with PyTorch’s automatic mixed precision package. See the user guide chapter for how to use it.
- (Experimental) New APIs for sparse embedding: (#2451)
dgl.nn.NodeEmbedding
: A class for storing node embeddings that is optimized for training on large-scale graphs.dgl.optim.SparseAdagrad
anddgl.optim.SparseAdam
: Optimizers to work withdgl.nn.NodeEmbedding
.
- (Experimental) Distributed heterogeneous support:
- Enable heterogeneous graph interfaces in
DistGraph
such asg.nodes['type'].data['feat']
, as well as sampling on distributed heterogeneous graph viadgl.sample_neighbors
. See this user guide chapter for more details. - Support distributed graph partitioning on a cluster of machines. See this user guide chapter for more details.
- Enable heterogeneous graph interfaces in
Improvements
- API improvement:
GraphConv
,SAGEConv
,GINConv
now support weighted graph. Users can pass in edge weights via an optionaledge_weight
argument. Also add a new NN moduleEdgeWeightNorm
which normalizes edge weights according to Kipf’s GCN paper. (#2557) - API improvement: Add an optional argument device to all dataloaders (e.g., NodeDataLoader , EdgeDataLoader) to indicate the target device of the produced graph minibatches. (#2450)
- API improvement: Allow GATConv and DotGATConv to return attention values (#2397).
- API improvement: Allow multiple heads in DotGATConv. (#2549) (Credits to @Ericcsr)
- API improvement: Add an optional flag reverse_edge to CitationGraphDataset to disable adding reverse edges to the graph. (#2588) (Credits to @juliasun623 )
- A new implementation for nn.RelGraphConv when low_mem=True. A benchmark on V100 GPU shows it gives a 4.8x boost in training speed on AIFB dataset. (#2468)
- Allow DGL to use PyTorch’s native memory allocator whenever possible. This saves a large number of malloc/free by caching the allocated buffers inside PyTorch (#2328, #2454).
- Speedup DGL by removing unnecessary sorting on CSR structure (#2391) (Credits to @nv-dlasalle )
- Add an option to mini-batch training examples (e.g., GraphSAGE, ClusterGAT, GAT, RGCN) that loads all node features to GPU prior to model training. The option speeds up model training significantly but consumes more GPU memory. (#2453)
- AVX support for faster CPU kernels (#2309) (Credits to @pawelpiotrowicz ). Enabled in binary releases.
- Add a USE_AVX flag in CMake options to allow disabling AVX optimization on hardware that do not support it. (#2428, #2438) Enabled in binary releases.
- Change dgl.remove_nodes and dgl.remove_edges to not override the NID and EID feature field by default. (#2465)
- Allow dgl.batch to batch a list of empty graphs. (#2527) (Credits to @noncomputable )
- Speedup HGT example by using DGL built-in functions (2x faster) (#2394). (Credits to @Maybewuss )
- Speedup cuSPARSE SpMM by using another algorithm (4x faster) (#2550). (Credits to @nv-dlasalle )
- Speedup mini-batch generation by removing unnecessary format conversion (#2551). (Credits to @nv-dlasalle )
- Enable in_degrees and out_degrees on DGLGraph with only COO format. (#2565)
- Enable dgl.to_block on CUDA. (#2339) (Credits to @nv-dlasalle )
- Add a compilation option to compile a tailored TVM runtime into DGL. (#2367) Disabled in binary releases. (Credits to @kira-lin )
Bugfixes
- Fix an issue regarding to OpenMP which causes performance regression when launching multiple training tasks on multi-core machines (#2412).
- Fix a bug where message passing is ignored for empty graph (#2387).
- Fix a bug where citation dataset never loads from cached data. Improve the error message. (#2421)
- Fix a bug in distributed training to allow reusing ports after sockets are closed (#2418)
- Fix a bug in PyTorch backend which produces spontaneous warnings. (#2434)
- Fix a bug that shared memory is not properly deleted when the process is killed by signals. (#2419)
- Fix a bug in knowledge graph dataset which causes undefined variable error. (#2475)
- Fix multiple bugs in metapath2vec (#2491, #2607) (Credits to @pein-hub, @zezhishao )
- Fix a bug in send_and_recv and pull that causes node data writing to wrong places. (#2497)
- Fix a bug in GATConv which changes the model parameters. (#2533)
- Fix a bug that erases empty node features after graph mutation. (#2529) (Credits to @noncomputable )
- Fix an undefined variable bug in LegacyTUDataset. (#2543) (Credits to @lygztq)
- Fix the version check for PyTorch. (#2544)
- Fix a bug in Coauthor datasets that causes duplicate edges (#2569)
- Fix a bug in DGLDataset which prevents it from pickling on Windows (#2572)
- Fix a bug in HeteroGraphConv where node features are not properly handled (#2578)
- Fix a bug in message passing kernels where input data can have different data types. (#2598)
- Fix a boundary bug in segment_sum. (#2610)
- Fix a bug in GINDataset and TUDataset where the node features are in float64 instead of float32. (#2592)
- Fix a bug in dgl.nn.RelGraphConv when the out_feat is one. (#2650)
- Lots of documentation fixes. (Thanks to @Ericcsr, @coco11563 , @cruyffturn , @timgates42 , @standbyme, @Lyken17 , and many others)
Breaking changes
HeteroGraphConv
now requires you to give features for all node types even if the computation in the child modules does not use it. For example, the following code no longer works:You will need to give a dummy feature to make it work if you are sure that node type 'B' is not used:g = dgl.heterograph({('A', 'AB', 'B'):([0,1],[1,2])}) conv = dglnn.HeteroGraphConv({'AB': GraphConv(5, 10)}) conv(g, {'A': torch.randn(2, 5)})
conv(g, {'A': torch.randn(2, 5), 'B': torch.randn(3, 10)})