Skip to content

Commit

Permalink
first commit after paper revision
Browse files Browse the repository at this point in the history
  • Loading branch information
gzn00417 committed Sep 5, 2023
0 parents commit 09791ad
Show file tree
Hide file tree
Showing 20 changed files with 1,114 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/log
/out
/data
**/__pycache__
7 changes: 7 additions & 0 deletions args/citeseer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_clients: 5
hidden_dim: 64
dropout: 0.1
lr: 0.01
step_size: 16
gamma: 0.9
patience: 16
7 changes: 7 additions & 0 deletions args/cora.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_clients: 5
hidden_dim: 64
dropout: 0.0
lr: 0.005
step_size: 4
gamma: 0.9
patience: 16
7 changes: 7 additions & 0 deletions args/cora_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_clients: 1
hidden_dim: 64
dropout: 0.0
lr: 0.05
step_size: 1
gamma: 0.9
patience: 16
7 changes: 7 additions & 0 deletions args/cora_10.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_clients: 10
hidden_dim: 64
dropout: 0.0
lr: 0.005
step_size: 8
gamma: 0.9
patience: 16
7 changes: 7 additions & 0 deletions args/cora_20.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_clients: 20
hidden_dim: 64
dropout: 0.0
lr: 0.005
step_size: 4
gamma: 0.9
patience: 16
7 changes: 7 additions & 0 deletions args/cora_30.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_clients: 30
hidden_dim: 64
dropout: 0.0
lr: 0.01
step_size: 1
gamma: 0.9
patience: 16
7 changes: 7 additions & 0 deletions args/cora_5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_clients: 5
hidden_dim: 64
dropout: 0.0
lr: 0.005
step_size: 4
gamma: 0.9
patience: 16
7 changes: 7 additions & 0 deletions args/cora_50.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_clients: 50
hidden_dim: 64
dropout: 0.0
lr: 0.01
step_size: 1
gamma: 0.9
patience: 16
7 changes: 7 additions & 0 deletions args/dblp_conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_clients: 20
hidden_dim: 64
dropout: 0.1
lr: 0.03
step_size: 8
gamma: 0.9
patience: 16
7 changes: 7 additions & 0 deletions args/dblp_org.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_clients: 8
hidden_dim: 64
dropout: 0.0
lr: 0.1
step_size: 4
gamma: 0.9
patience: 16
7 changes: 7 additions & 0 deletions args/pubmed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_clients: 5
hidden_dim: 128
dropout: 0.0
lr: 0.1
step_size: 8
gamma: 0.9
patience: 16
32 changes: 32 additions & 0 deletions code/args.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from typing import *
import argparse
import pytorch_lightning as pl
import yaml
import os


def parse_global_args():
parser = argparse.ArgumentParser()
parser = pl.Trainer.add_argparse_args(parser)

parser.add_argument('--root', type=str, default='/home/guozhuoning/projects/hierarchical_fed_graph/')
parser.add_argument('--data_folder', type=str, default='data')
parser.add_argument('--args_folder', type=str, default='args')
parser.add_argument('-D', '--dataset_name', type=str)
parser.add_argument('-E', '--epochs', type=int, default=1024, help='epoch size')
parser.add_argument('--train_batch_size', type=int, default=1, help='train batch size.')
parser.add_argument('--val_batch_size', type=int, default=1, help='validation batch size.')
parser.add_argument('--test_batch_size', type=int, default=1, help='test batch size.')
parser.add_argument('--monitor', type=str, default='ACC', help='training monitor')
parser.add_argument('--cross_client', type=bool, default=True, help='whether the graph remains the cross-client edges')
parser.add_argument('--num_layers', type=int, default=2, help='number of gnn layers')

global_args, _ = parser.parse_known_args()
return parser, global_args


def parse_dataset_specific_args(parent_args: argparse.Namespace):
with open(os.path.join(parent_args.root, parent_args.args_folder, f'{parent_args.dataset_name}.yaml'), 'r') as f:
dataset_specific_args = yaml.load(f, Loader=yaml.FullLoader)
parent_args.__dict__.update(**dataset_specific_args)
return parent_args
Loading

0 comments on commit 09791ad

Please sign in to comment.