Skip to content

Commit

Permalink
[Doc] v0.2.1 release (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
cenyk1230 authored Mar 3, 2021
1 parent a9a66d7 commit eb0e463
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 48 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,13 @@ from cogdl import pipeline
stats = pipeline("dataset-stats")
stats(["cora", "citeseer"])

# visualize k-hop neighbors of seed in the dataset
visual = pipeline("dataset-visual")
visual("cora", seed=0, depth=3)

# load OAGBert model and perform inference
oagbert = pipeline("oagbert")
outputs = oagbert(["CogDL is developed by KEG, Tsinghua.", "OAGBert is developed by KEG, Tsinghua."])
```

More details of the OAGBert usage can be found [here](./cogdl/oag/README.md).

### Command-Line Usage

You can also use `python scripts/train.py --task example_task --dataset example_dataset --model example_model` to run example_model on example_data and evaluate it via example_task.
Expand Down Expand Up @@ -144,6 +142,12 @@ Expected output:

If you have ANY difficulties to get things working in the above steps, feel free to open an issue. You can expect a reply within 24 hours.

### Fast-Spmm Usage

CogDL provides a fast sparse matrix-matrix multiplication operator called [GE-SpMM](https://arxiv.org/abs/2007.03179) to speed up training of GNN models on the GPU.
You can set `fast_spmm=True` in the API usage or `--fast-spmm` in the command-line usage to enable this feature.
Note that this feature is still in testing and may not work under some versions of CUDA.

## Docker container

You might also opt to use a Docker container. There is an image available in this repo that you can build with the Torch and CUDA versions available in your system. To build the docker image just run:
Expand Down
12 changes: 7 additions & 5 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pip install -e .

## 使用说明

### API
### API用法

您可以通过CogDL API进行各种实验,尤其是`experiment`[quick_start.py](https://github.com/THUDM/cogdl/tree/master/examples/quick_start.py)这是一个快速入门的代码。您也可以使用自己的数据集和模型进行实验。[examples/](https://github.com/THUDM/cogdl/tree/master/examples/) 文件夹里提供了一些例子。

Expand Down Expand Up @@ -94,15 +94,12 @@ from cogdl import pipeline
stats = pipeline("dataset-stats")
stats(["cora", "citeseer"])

# visualize k-hop neighbors of seed in the dataset
visual = pipeline("dataset-visual")
visual("cora", seed=0, depth=3)

# load OAGBert model and perform inference
oagbert = pipeline("oagbert")
outputs = oagbert(["CogDL is developed by KEG, Tsinghua.", "OAGBert is developed by KEG, Tsinghua."])
```

有关OAGBert更多的用法可以参见[这里](./cogdl/oag/README.md).

### 命令行
基本用法可以使用 `python train.py --task example_task --dataset example_dataset --model example_model` 来在 `example_data` 上运行 `example_model` 并使用 `example_task` 来评测结果。
Expand Down Expand Up @@ -137,6 +134,11 @@ $ python scripts/parallel_train.py --task node_classification --dataset cora --m
| ('cora', 'gcn') | 0.8236±0.0033 |
| ('cora', 'gat') | 0.8262±0.0032 |

### Fast-Spmm用法

CogDL提供了一种快速的稀疏矩阵乘的操作([GE-SpMM](https://arxiv.org/abs/2007.03179))来加速图神经网络模型在GPU上的训练效率。
你可以设置`fast_spmm=True`或者`--fast-spmm`来启用这个特性。
需要注意的是这个特性仍在测试阶段,可能在某些CUDA版本下无法正常使用。

## Docker

Expand Down
2 changes: 1 addition & 1 deletion cogdl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.2.0.post1"
__version__ = "0.2.1"

from .experiments import experiment
from .oag import oagbert
Expand Down
4 changes: 3 additions & 1 deletion cogdl/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from cogdl.options import get_default_args
from cogdl.tasks import build_task
from cogdl.utils import set_random_seed, tabulate_results
from cogdl.utils import set_random_seed, tabulate_results, initialize_spmm
from cogdl.configs import BEST_CONFIGS
from cogdl.datasets import SUPPORTED_DATASETS
from cogdl.models import SUPPORTED_MODELS
Expand Down Expand Up @@ -149,6 +149,8 @@ def raw_experiment(task: str, dataset, model, **kwargs):
else:
args = kwargs["args"]

initialize_spmm(args)

variants = list(gen_variants(dataset=args.dataset, model=args.model, seed=args.seed))
variants = check_task_dataset_model_match(task, variants)

Expand Down
2 changes: 0 additions & 2 deletions cogdl/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from cogdl.models import MODEL_REGISTRY, try_import_model
from cogdl.tasks import TASK_REGISTRY
from cogdl.trainers import TRAINER_REGISTRY, try_import_trainer
from cogdl.utils import initialize_spmm


def get_parser():
Expand Down Expand Up @@ -131,7 +130,6 @@ def parse_args_and_arch(parser, args):
TRAINER_REGISTRY[args.trainer].add_args(parser)
# Parse a second time.
args = parser.parse_args()
initialize_spmm(args)
return args


Expand Down
1 change: 1 addition & 0 deletions cogdl/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def initialize_spmm(args):

global fast_spmm
fast_spmm = csrspmm
print("Using fast-spmm to speed up training")
except Exception as e:
print(e)

Expand Down
4 changes: 2 additions & 2 deletions docs/source/api/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ Matlab matrix dataset
PyG OGB dataset
-------------------------------

.. automodule:: cogdl.datasets.pyg_ogb
.. automodule:: cogdl.datasets.ogb
:members:
:undoc-members:
:show-inheritance:

PyG strategies dataset
-------------------------------

.. automodule:: cogdl.datasets.pyg_strategies_data
.. automodule:: cogdl.datasets.strategies_data
:members:
:undoc-members:
:show-inheritance:
Expand Down
14 changes: 2 additions & 12 deletions docs/source/api/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,6 @@ GNN Model
:undoc-members:
:show-inheritance:

.. autoclass:: cogdl.models.nn.fastgcn.FastGCN
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: cogdl.models.nn.mlp.MLP
:members:
:undoc-members:
Expand All @@ -321,7 +316,7 @@ GNN Model
:undoc-members:
:show-inheritance:

.. autoclass:: cogdl.models.nn.pyg_stpgnn.stpgnn
.. autoclass:: cogdl.models.nn.stpgnn.stpgnn
:members:
:undoc-members:
:show-inheritance:
Expand All @@ -336,11 +331,6 @@ GNN Model
:undoc-members:
:show-inheritance:

.. autoclass:: cogdl.models.nn.asgcn.ASGCN
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: cogdl.models.nn.dgl_gcc.GCC
:members:
:undoc-members:
Expand All @@ -365,7 +355,7 @@ GNN Model
AGC Model
---------

.. autoclass:: cogdl.models.agc.pyg_daegc.DAEGC
.. autoclass:: cogdl.models.agc.daegc.DAEGC
:members:
:undoc-members:
:show-inheritance:
Expand Down
8 changes: 0 additions & 8 deletions docs/source/api/tasks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ Unsupervised Node Classification
:undoc-members:
:show-inheritance:

Node Classification (with sampling)
-------------------------------------------

.. automodule:: cogdl.tasks.node_classification_sampling
:members:
:undoc-members:
:show-inheritance:

Heterogeneous Node Classification
--------------------------------------------

Expand Down
40 changes: 27 additions & 13 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,33 @@ CogDL is a graph representation learning toolkit that allows researchers and dev

We summarize the contributions of CogDL as follows:

- **High Efficiency**: CogDL utilizes well-optimized operators to speed up training and save GPU memory of GNN models.
- **Easy-to-Use**: CogDL provides easy-to-use APIs for running experiments with the given models and datasets using hyper-parameter search.
- **Extensibility**: The design of CogDL makes it easy to apply GNN models to new scenarios based on our framework.
- **Reproducibility**: CogDL provides reproducible leaderboards for state-of-the-art models on most of important tasks in the graph domain.

Supported tasks:

- Node classification
- Link prediction
- Graph classification
- Graph pre-training
- Graph clustering
- Graph similarity search
- **High Efficiency**: CogDL utilizes well-optimized operators to speed up training and save GPU memory of GNN models.
- **Easy-to-Use**: CogDL provides easy-to-use APIs for running experiments with the given models and datasets using hyper-parameter search.
- **Extensibility**: The design of CogDL makes it easy to apply GNN models to new scenarios based on our framework.
- **Reproducibility**: CogDL provides reproducible leaderboards for state-of-the-art models on most of important tasks in the graph domain.

❗ News
------------

- We release the first version of `CogDL paper <https://arxiv.org/abs/2103.00959>`_ in arXiv. You can join `our slack <https://join.slack.com/t/cogdl/shared_invite/zt-b9b4a49j-2aMB035qZKxvjV4vqf0hEg>`_ for discussion.🎉
- The new **v0.2.0 release** includes easy-to-use ``experiment`` and ``pipeline`` APIs for all experiments and applications. The ``experiment`` API supports automl features of searching hyper-parameters. This release also provides ``OAGBert`` API for model inference (``OAGBert`` is trained on large-scale academic corpus by our lab). Some features and models are added by the open source community (thanks to all the contributors 🎉).
- The new **v0.1.2 release** includes a pre-training task, many examples, OGB datasets, some knowledge graph embedding methods, and some graph neural network models. The coverage of CogDL is increased to 80%. Some new APIs, such as ``Trainer`` and ``Sampler``, are developed and being tested.
- The new **v0.1.1 release** includes the knowledge link prediction task, many state-of-the-art models, and ``optuna`` support. We also have a `Chinese WeChat post <https://mp.weixin.qq.com/s/IUh-ctQwtSXGvdTij5eDDg>`_ about the CogDL release.

Citing CogDL
------------

Please cite `our paper <https://arxiv.org/abs/2103.00959>`_ if you find our code or results useful for your research:

::

@article{cen2021cogdl,
title={CogDL: An Extensive Toolkit for Deep Learning on Graphs},
author={Yukuo Cen and Zhenyu Hou and Yan Wang and Qibin Chen and Yizhen Luo and Xingcheng Yao and Aohan Zeng and Shiguang Guo and Peng Zhang and Guohao Dai and Yu Wang and Chang Zhou and Hongxia Yang and Jie Tang},
journal={arXiv preprint arXiv:2103.00959},
year={2021}
}


.. toctree::
:maxdepth: 2
Expand Down
8 changes: 8 additions & 0 deletions docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,11 @@ Variant Acc
('cora', 'gcn') 0.8236±0.0033
('cora', 'gat') 0.8262±0.0032
========================= ==============


Fast-Spmm Usage
---------------

CogDL provides a fast sparse matrix-matrix multiplication operator called `GE-SpMM <https://arxiv.org/abs/2007.03179>`_ to speed up training of GNN models on the GPU.
You can set ``fast_spmm=True`` in the API usage or ``--fast-spmm`` in the command-line usage to enable this feature.
Note that this feature is still in testing and may not work under some versions of CUDA.

0 comments on commit eb0e463

Please sign in to comment.