Git Product home page Git Product logo

pku-dair / sgl Goto Github PK

View Code? Open in Web Editor NEW
129.0 4.0 20.0 4.17 MB

A scalable graph learning toolkit for extremely large graph datasets. (WWW'22, ๐Ÿ† Best Student Paper Award)

Home Page: https://sgl-doc.readthedocs.io/en/latest

License: MIT License

Python 93.08% C 6.92%
deep-learning geometric-deep-learning graph-neural-networks scalable-graph-learning network-embedding neural-architecture-search pytorch

sgl's Introduction

SGL: Scalable Graph Learning

SGL is a Graph Neural Network (GNN) toolkit targeting scalable graph learning, which supports deep graph learning on extremely large datasets. SGL allows users to easily implement scalable graph neural networks and evaluate its performance on various downstream tasks like node classification, node clustering, and link prediction. Further, SGL supports auto neural architecture search functionality based on OpenBox. SGL is designed and developed by the graph learning team from the DAIR Lab at Peking University.

Why SGL๏ผŸ

The key difference between SGL and existing GNN toolkits, such as PyTorch Geometric (PyG) and Deep Graph Library (DGL), is that, SGL enjoys the characteristics of the follwing three perspectives.

  • High scalability: Following the scalable design paradigm SGAP in PaSca, SGL can scale to graph data with billions of nodes and edges.
  • Auto neural architecture search: SGL can automatically choose decent and scalable graph neural architectures according to specific tasks and pre-defined multiple objectives (e.g., inference time, memory cost, and predictive performance).
  • Ease of use: SGL has user-friendly interfaces for implementing existing scalable GNNs and executing various downstream tasks.

Installation

Some datasets in SGL are constructed based on PyG. Please follow the link below to install PyG first before installing SGL: https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html.

Install from pip

To install SGL from PyPI:

pip install sgl-dair

Quick Start

A quick start example is given by:

from sgl.dataset import Planetoid
from sgl.models.homo import SGC
from sgl.tasks import NodeClassification

dataset = Planetoid("pubmed", "./", "official")
model = SGC(prop_steps=3, feat_dim=dataset.num_features, output_dim=dataset.num_classes)

device = "cuda:0"
test_acc = NodeClassification(dataset, model, lr=0.1, weight_decay=5e-5, epochs=200, device=device).test_acc

An example of the auto neural network search functionality is as follows:

import torch
from openbox.optimizer.generic_smbo import SMBO

from sgl.dataset.planetoid import Planetoid
from sgl.search.search_config import ConfigManager

dataset = Planetoid("cora", "./", "official")
device = torch.device(f"cuda:{0}" if torch.cuda.is_available() else "cpu")

## Define Initial Arch and Configuration
initial_arch = [2, 0, 1, 2, 3, 0, 0]
configer = ConfigManager(initial_arch)
configer._setParameters(dataset, device, 128, 200, 1e-2, 5e-4)

## Define Search Parameters
dim = 7
bo = SMBO(configer._configFunction,
          configer._configSpace(),
          num_objs=2,
          num_constraints=0,
          max_runs=3500,
          surrogate_type='prf',
          acq_type='ehvi',
          acq_optimizer_type='local_random',
          initial_runs=2 * (dim + 1),
          init_strategy='sobol',
          ref_point=[-1, 0.00001],
          time_limit_per_trial=5000,
          task_id='quick_start',
          random_state=1)

## Search
history = bo.run()
print(history)

Related Publications

PaSca: a Graph Neural Architecture Search System under the Scalable Paradigm[PDF]
Wentao Zhang, Yu Shen, Zheyu Lin, Yang Li, Xiaosen Li, Wen Ouyang, Yangyu Tao, Zhi Yang, and Bin Cui.
The world wide web conference.
WWW 2022, CCF-A, ๐Ÿ† Best Student Paper Award (among 1822 submmisions)

Node Dependent Local Smoothing for Scalable Graph Learning [PDF]
Wentao Zhang, Mingyu Yang, Zeang Sheng, Yang Li, Wen Ouyang, Yangyu Tao, Zhi Yang, Bin Cui.
Thirty-fifth Conference on Neural Information Processing Systems.
NeurIPS 2021, CCF-A, Spotlight Presentation, Acceptance Rate: < 3%.

NAFS: A Simple yet Tough-to-beat Baseline for Graph Representation Learning. [PDF]
Wentao Zhang, Zeang Sheng, Mingyu Yang, Yang Li, Yu Shen, Zhi Yang, Bin Cui.
The 39th International Conference on Machine Learning.
ICML 2022, CCF-A.

Deep and Flexible Graph Neural Architecture Search. [PDF]
Wentao Zhang, Zheyu Lin, Yu Shen, Yang Li, Zhi Yang, Bin Cui.
The 39th International Conference on Machine Learning.
ICML 2022, CCF-A.

Model Degradation Hinders Deep Graph Neural Networks. [PDF]
Wentao Zhang, Zeang Sheng, Yuezihan Jiang, Yikuan Xia, Jun Gao, Zhi Yang, Bin Cui.
SIGKDD Conference on Knowledge Discovery and Data Mining.
KDD 2022, CCF-A.

Graph Attention Multi-Layer Perceptron [PDF]
Wentao Zhang, Ziqi Yin, Zeang Sheng, Wen Ouyang, Xiaosen Li, Yangyu Tao, Zhi Yang, Bin Cui.
ACM SIGKDD Conference on Knowledge Discovery and Data Mining.
KDD 2022, CCF-A, Rank #1 in Open Graph Benchmark

OpenBox: A Generalized Black-box Optimization Service [PDF]
Yang Li, Yu Shen, Wentao Zhang, Yuanwei Chen, ..., Wentao Wu, Zhi Yang, Ce Zhang, Bin Cui.
ACM SIGKDD Conference on Knowledge Discovery and Data Mining.
KDD 2021, CCF-A, top prize in open-source innovation competition @ 2021 CCF ChinaSoft

Citing SGL

Please cite our paper if you find SGL useful in your work:

@inproceedings{zhang2022pasca,
  title={PaSca: A Graph Neural Architecture Search System under the Scalable Paradigm},
  author={Zhang, Wentao and Shen, Yu and Lin, Zheyu and Li, Yang and Li, Xiaosen and Ouyang, Wen and Tao, Yangyu and Yang, Zhi and Cui, Bin},
  booktitle={Proceedings of the ACM Web Conference 2022},
  pages={1817--1828},
  year={2022}
}

Contact

If you have any technical questions, please submit new issues.

If you have any other questions, please contact: Wentao Zhang[[email protected]] and Zeang Sheng[[email protected]].

License

The entire codebase is under MIT license.

sgl's People

Contributors

caolonghao avatar infinity1009 avatar lzheyu avatar rennie-bee avatar shengzeang avatar theroadqaq avatar zhenbangyou avatar zwt233 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sgl's Issues

Where is PASCA-V1 (V2, V3)

Hi, Your paper is really interesting, and I try to retype this code and find that PASCA-V1(V2, V3) are not included in this respority. From this code, we know that SGAP is a fundamental framework of this paper, and SGC is constructed based on this framework, am I right?

cannot run the quick start example

Describe the bug

code:
from sgl.dataset import Planetoid
from sgl.models.homo import SGC
from sgl.tasks import NodeClassification

dataset = Planetoid("pubmed", "./", "official")
model = SGC(prop_steps=3, feat_dim=dataset.num_features, num_classes=dataset.num_classes)

device = "cuda:0"
test_acc = NodeClassification(dataset, model, lr=0.1, weight_decay=5e-5, epochs=200, device=device).test_acc

bug:
Traceback (most recent call last):
File "quick_start.py", line 9, in
test_acc = NodeClassification(dataset, model, lr=0.1, weight_decay=5e-5, epochs=200, device=device).test_acc
File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/sgl/tasks/node_classification.py", line 39, in init
self.__test_acc = self._execute()
File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/sgl/tasks/node_classification.py", line 49, in _execute
self.__model.preprocess(self.__dataset.adj, self.__dataset.x)
File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/sgl/models/base_model.py", line 25, in preprocess
self._processed_feat_list = self._pre_graph_op.propagate(
File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/sgl/operators/base_op.py", line 32, in propagate
feat_temp = csr_sparse_dense_matmul(self._adj, prop_feat_list[-1])
File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/sgl/operators/utils.py", line 10, in csr_sparse_dense_matmul
ctl_lib = ctl.load_library("./csrc/libmatmul.so", "./operators/")
File "/home/ubuntu/miniconda3/lib/python3.8/site-packages/numpy/ctypeslib.py", line 163, in load_library
raise OSError("no file with expected extension")
OSError: no file with expected extension

Environment

  • PyG version:2.0.4
  • PyTorch versn:1.11.0
  • OS:ubuntu18.04
  • Python version:3.8.5
  • CUDA/cuDNN version:CUDA 11.4
  • How we installed PyTorch and PyG (conda, pip, source):conda
  • Any other relevant information (e.g., version of torch-scatter):
  • pytorch-scatter:2.0.9
  • pytorch-sparse:0.6.13
  • pytorch-spline-conv:1.2.1
  • pytorch-cluster:1.6.0
  • torch-geometric:2.0.4
  • torchaudio: 0.11.0
  • torchvision:0.12.0
  • numpy:1.22.3
  • scipy:1.8.0

Question
I don't know why such a mistake happened. Please help me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.