Note: This repository modified from graphdeeplearning/benchmarking-gnns. We refactor the code using the pyg framework and add the planetoid and ogb datasets to make the node classification.
- Setup Python environment for GPU
git clone https://https://github.com/karl-zhao/benchmarking-gnns-pyg.git
cd benchmarking-gnns-pyg
# Install python environment
conda env create -f environment_gpu.yml
# Activate environment
conda activate pytorch1.5.0
All the datasets can be downloaded automatically except SBMs. For the SBMs, run the data/SBMs/generate_SBM_CLUSTER.ipynb and data/SBMs/generate_SBM_PATTERN.ipynb first to generate the dataset.
# Run the main file (at the root of the project)
python main_arxiv_node_classification.py --dataset ogbn-arxiv --gpu_id 0 --seed 41 --config configs/arxiv_node_classification_GAT_pyg_90k.json # for GPU
It will first download the datasets and then train the model.
The training and network parameters for each dataset and network is stored in a json file in the configs/
directory.
Run the script,you can see the scripts for detail.
# Run the scripts (at the root of the project)
bash scripts/ogbs/script_main_node_classification_arxivs_100k.sh # for GPU
If want to use the node2vec embedding, first run the main function to download the datasets. Then run node2vec_***.py for create the embeddings.
Output results are located in the folder defined by the variable out_dir
in the corresponding config file (eg. configs/arxiv_node_classification_GAT_pyg_90k.json
file).
ourdir also can change using --out_dir
- Go to
out/ogb_node_classification/results
to view all result text files. - Directory
out/ogb_node_classification/checkpoints
contains model checkpoints.
- Go to the logs directory, i.e.
out/molecules_graph_regression/logs/
. - Run the commands
source activate benchmark_gnn
tensorboard --logdir='./' --port 6006
- Open
http://localhost:6006
in your browser. Note that the port information (here 6006 but it may change) appears on the terminal immediately after starting tensorboard.
- Go to the logs directory, i.e.
out/molecules_graph_regression/logs/
. - Run the script with
bash script_tensorboard.sh
. - On your local machine, run the command
ssh -N -f -L localhost:6006:localhost:6006 user@xx.xx.xx.xx
. - Open
http://localhost:6006
in your browser. Note thatuser@xx.xx.xx.xx
corresponds to your user login and the IP of the remote machine.
@misc{zhao2020pipeline,
title={A pipeline for fair comparison of graph neural networks in node classification tasks},
author={Wentao Zhao and Dalin Zhou and Xinguo Qiu and Wei Jiang},
year={2020},
eprint={2012.10619},
archivePrefix={arXiv},
primaryClass={cs.LG}
}