This repository contains pretraining and finetuning scripts for STEM-GNN, plus multiple evaluation scripts.
Quick Start
- Go to the repo root (
STEM-GNN). - Create and activate the environment.
conda env create -f environment.yml
conda activate STEM-GNNProject Layout
STEM-GNN/pretrain.py: pretrain entrySTEM-GNN/finetune.py: generic finetune entrySTEM-GNN/scripts/: evaluation/variant scriptsSTEM-GNN/data/: datasets (organized per script expectations)STEM-GNN/ckpts/: checkpoints outputconfig/: config templates (pretrain.yaml,finetune.yaml)
Pretrain Run from the repo root:
python STEM-GNN/pretrain.py --use_paramsCommon example:
python STEM-GNN/pretrain.py \
--use_params \
--gpu 0 \
--pretrain_dataset all \
--pretrain_epochs 50Output path:
- Pretrained checkpoints are saved to
STEM-GNN/ckpts/pretrain_model/
Finetune Generic finetune (node task):
python STEM-GNN/finetune.py --use_params --finetune_dataset cora --gpu 0If you need to load a specific pretrained checkpoint:
python STEM-GNN/finetune.py \
--use_params \
--finetune_dataset cora \
--pretrain_model_epoch 25Or point directly to the checkpoint folder:
python STEM-GNN/finetune.py \
--use_params \
--finetune_dataset cora \
--pretrain_path STEM-GNN/ckpts/pretrain_model/your_runScripts (in STEM-GNN/scripts/)
All scripts below support node tasks only:
# Degree Shift OOD
python STEM-GNN/scripts/degree_shift_ood.py --use_params --finetune_dataset cora
# Homophily Shift OOD
python STEM-GNN/scripts/homophily_shift_ood.py --use_params --finetune_dataset cora
# Missing Feature
python STEM-GNN/scripts/missing_feature.py --use_params --finetune_dataset cora
# Random Edge Drop
python STEM-GNN/scripts/random_edge_drop.py --use_params --finetune_dataset cora
# Tri-objective finetune
python STEM-GNN/scripts/tri_objective.py --use_params --finetune_dataset coraNotes
--use_paramsloads defaults fromconfig/finetune.yamlorconfig/pretrain.yaml.- Put data under
STEM-GNN/data, and checkpoints underSTEM-GNN/ckpts.