Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions federatedscope/contrib/data/graph_dt.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def __call__(self, data):


class GraphDTDataset(InMemoryDataset):
inmemory_data = {}
def __init__(self, root):
self.root = root
super().__init__(root)
Expand Down Expand Up @@ -177,7 +178,7 @@ def process(self):
os.makedirs(os.path.join(self.processed_dir, str(idx)))

train_path = os.path.join(self.processed_dir, str(idx), 'train.pt')
test_path = os.path.join(self.processed_dir, str(idx), 'train.pt')
test_path = os.path.join(self.processed_dir, str(idx), 'test.pt')
valid_path = os.path.join(self.processed_dir, str(idx), 'val.pt')

if idx == 1:
Expand Down Expand Up @@ -258,12 +259,16 @@ def process(self):
torch.save(pro_valid, valid_path)

def __getitem__(self, idx):
data = {}
for split in ['train', 'val', 'test']:
split_data = self._load(idx, split)
if split_data:
data[split] = split_data
return data
if idx in self.inmemory_data:
return self.inmemory_data[idx]
else:
self.inmemory_data[idx] = {}
for split in ['train', 'val', 'test']:
split_data = self._load(idx, split)
if split_data:
self.inmemory_data[split] = split_data
return self.inmemory_data[idx]



def load_graph_dt_data(config):
Expand Down
28 changes: 14 additions & 14 deletions scripts/B-FHTL_exp_scripts/Graph-DT/cfg_per_client_ditto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,40 @@ client_1:
criterion:
type: MSELoss
optimizer:
lr: 0.01
lr: 0.05
grad_clip: 5.0
federate:
local_update_steps: 4
local_update_steps: 50
client_2:
model:
out_channels: 1
task: graphRegression
criterion:
type: MSELoss
optimizer:
lr: 0.1
lr: 0.05
federate:
local_update_steps: 2
local_update_steps: 20
client_3:
model:
out_channels: 1
task: graphRegression
criterion:
type: MSELoss
optimizer:
lr: 0.1
lr: 0.05
federate:
local_update_steps: 14
local_update_steps: 20
client_4:
model:
out_channels: 2
task: graphClassification
criterion:
type: CrossEntropyLoss
optimizer:
lr: 0.01
lr: 0.05
federate:
local_update_steps: 5
local_update_steps: 20
client_5:
model:
out_channels: 2
Expand All @@ -48,7 +48,7 @@ client_5:
optimizer:
lr: 0.05
federate:
local_update_steps: 7
local_update_steps: 20
client_6:
model:
out_channels: 2
Expand All @@ -58,7 +58,7 @@ client_6:
optimizer:
lr: 0.05
federate:
local_update_steps: 5
local_update_steps: 10
client_7:
model:
out_channels: 2
Expand Down Expand Up @@ -108,15 +108,15 @@ client_11:
optimizer:
lr: 0.1
federate:
local_update_steps: 1
local_update_steps: 5
client_12:
model:
out_channels: 2
task: graphClassification
criterion:
type: CrossEntropyLoss
optimizer:
lr: 0.05
lr: 0.1
federate:
local_update_steps: 14
client_13:
Expand All @@ -136,7 +136,7 @@ client_14:
criterion:
type: MSELoss
optimizer:
lr: 0.05
lr: 0.1
federate:
local_update_steps: 675
client_15:
Expand All @@ -156,6 +156,6 @@ client_16:
criterion:
type: MSELoss
optimizer:
lr: 0.05
lr: 0.1
federate:
local_update_steps: 431
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ data:
model:
type: gin
hidden: 64
task: graph
personalization:
local_param: ['encoder_atom', 'encoder', 'clf'] # to handle size-different pre & post layers
regular_weight: 0.01
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data:
model:
type: gin
hidden: 64
task: graph
personalization:
local_param: ['encoder_atom', 'encoder', 'clf'] # to handle size-different pre & post layers
optimizer:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data:
model:
type: gin
hidden: 64
task: graph
personalization:
local_param: ['encoder_atom', 'encoder', 'clf'] # to handle size-different pre & post layers
optimizer:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data:
model:
type: gin
hidden: 64
task: graph
personalization:
local_param: [ 'encoder_atom', 'encoder', 'clf', 'norms' ] # pre, post + FedBN
optimizer:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data:
model:
type: gin
hidden: 64
task: graph
personalization:
local_param: [ 'encoder_atom', 'encoder', 'clf', 'norms' ] # pre, post + FedBN
optimizer:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data:
model:
type: gin
hidden: 64
task: graph
personalization:
local_param: ['encoder_atom', 'encoder', 'clf'] # to handle size-different pre & post layers
optimizer:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data:
model:
type: gin
hidden: 64
task: graph
personalization:
local_param: ['encoder_atom', 'encoder', 'clf'] # to handle size-different pre & post layers
optimizer:
Expand Down
3 changes: 2 additions & 1 deletion scripts/B-FHTL_exp_scripts/Graph-DT/hpo/run_contest_ditto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ root=$2
dataset=graph-dt
method=ditto
outdir=exp_out/${method}
datelog=$(date '+%Y-%m-%d-%H-%M-%S')

if [ ! -d ${outdir} ];then
mkdir ${outdir}
Expand All @@ -16,7 +17,7 @@ echo "HPO starts..."

personalization_regular_weight=0.01

log=${outdir}/gin_weight-${personalization_regular_weight}_on_${dataset}.log
log=${outdir}/gin_weight-${personalization_regular_weight}_on_${dataset}_${datelog}.log
for k in {1..3}
do
python federatedscope/main.py --cfg scripts/B-FHTL_exp_scripts/Graph-DT/hpo/ditto_gnn_minibatch_on_multi_task.yaml \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ root=$2
dataset=graph-dt
method=fedavg
outdir=exp_out/${method}
datelog=$(date '+%Y-%m-%d-%H-%M-%S')

if [ ! -d ${outdir} ];then
mkdir -p ${outdir}
fi

echo "HPO starts..."

log=${outdir}/gin_on_${dataset}.log
log=${outdir}/gin_on_${dataset}_${datelog}.log
for k in {1..3}
do
python federatedscope/main.py --cfg scripts/B-FHTL_exp_scripts/Graph-DT/hpo/fedavg_gnn_minibatch_on_multi_task.yaml \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ root=$2
dataset=graph-dt
method=fedavg_ft
outdir=exp_out/${method}
datelog=$(date '+%Y-%m-%d-%H-%M-%S')

if [ ! -d ${outdir} ];then
mkdir -p ${outdir}
Expand All @@ -16,7 +17,7 @@ echo "HPO starts..."

step=1

log=${outdir}/gin_lstep-${step}_on_${dataset}.log
log=${outdir}/gin_lstep-${step}_on_${dataset}_${datelog}.log
for k in {1..3}
do
python federatedscope/main.py --cfg scripts/B-FHTL_exp_scripts/Graph-DT/hpo/fedavg_ft_gnn_minibatch_on_multi_task.yaml \
Expand Down
3 changes: 2 additions & 1 deletion scripts/B-FHTL_exp_scripts/Graph-DT/hpo/run_contest_fedbn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ root=$2
dataset=graph-dt
method=fedbn
outdir=exp_out/${method}
datelog=$(date '+%Y-%m-%d-%H-%M-%S')

if [ ! -d ${outdir} ];then
mkdir -p ${outdir}
fi

echo "HPO starts..."

log=${outdir}/gin_on_${dataset}.log
log=${outdir}/gin_on_${dataset}_${datelog}.log
for k in {1..3}
do
python federatedscope/main.py --cfg scripts/B-FHTL_exp_scripts/Graph-DT/hpo/fedbn_gnn_minibatch_on_multi_task.yaml \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ root=$2
dataset=graph-dt
method=fedbn_ft
outdir=exp_out/${method}
datelog=$(date '+%Y-%m-%d-%H-%M-%S')

if [ ! -d ${outdir} ];then
mkdir -p ${outdir}
Expand All @@ -16,7 +17,7 @@ echo "HPO starts..."

step=1

log=${outdir}/gin_patience-0_lstep-${step}_on_${dataset}.log
log=${outdir}/gin_patience-0_lstep-${step}_on_${dataset}_${datelog}.log
for k in {1..3}
do
python federatedscope/main.py --cfg scripts/B-FHTL_exp_scripts/Graph-DT/hpo/fedbn_ft_gnn_minibatch_on_multi_task.yaml \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ root=$2
dataset=graph-dt
method=fedprox
outdir=exp_out/${method}
datelog=$(date '+%Y-%m-%d-%H-%M-%S')

if [ ! -d ${outdir} ];then
mkdir -p ${outdir}
Expand All @@ -18,7 +19,7 @@ mus=(0.05)

for (( im=0; im<${#mus[@]}; im++ ))
do
log=${outdir}/gin_mu-${mus[$im]}_on_${dataset}.log
log=${outdir}/gin_mu-${mus[$im]}_on_${dataset}_${datelog}.log
for k in {1..3}
do
python federatedscope/main.py --cfg scripts/B-FHTL_exp_scripts/Graph-DT/hpo/fedavg_gnn_minibatch_on_multi_task.yaml \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ root=$2
dataset=graph-dt
method=isolated
outdir=exp_out/${method}
datelog=$(date '+%Y-%m-%d-%H-%M-%S')

if [ ! -d ${outdir} ];then
mkdir -p ${outdir}
fi

echo "HPO starts..."

log=${outdir}/gin_on_${dataset}.log
log=${outdir}/gin_on_${dataset}_${datelog}.log
for k in {1..3}
do
python federatedscope/main.py --cfg scripts/B-FHTL_exp_scripts/Graph-DT/hpo/fedavg_gnn_minibatch_on_multi_task.yaml \
Expand Down
3 changes: 2 additions & 1 deletion scripts/B-FHTL_exp_scripts/Graph-DT/hpo/run_contest_maml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ root=$2
dataset=graph-dt
method=maml
outdir=exp_out/${method}
datelog=$(date '+%Y-%m-%d-%H-%M-%S')

if [ ! -d ${outdir} ];then
mkdir -p ${outdir}
Expand All @@ -16,7 +17,7 @@ echo "HPO starts..."

ft_step=10

log=${outdir}/gin_mstep-${ft_step}_on_${dataset}.log
log=${outdir}/gin_mstep-${ft_step}_on_${dataset}_${datelog}.log
for k in {1..3}
do
python federatedscope/main.py --cfg scripts/B-FHTL_exp_scripts/Graph-DT/hpo/fedmaml_gnn_minibatch_on_multi_task.yaml \
Expand Down