Browse Source

PR [#73] debug/gcn-gat-node -> dev

debug for gcn & gat node clf
tags/v0.3.1
Frozenmad GitHub 4 years ago
parent
commit
35b2b7b02e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 31 additions and 28 deletions
  1. +0
    -2
      autogl/module/model/encoders/_dgl/_gat.py
  2. +0
    -2
      autogl/module/model/encoders/_dgl/_gcn.py
  3. +1
    -1
      test/performance/node_classification/dgl/helper.py
  4. +6
    -6
      test/performance/node_classification/dgl/model.py
  5. +20
    -11
      test/performance/node_classification/pyg/helper.py
  6. +1
    -1
      test/performance/node_classification/pyg/model_decouple.py
  7. +1
    -1
      test/performance/node_classification/pyg/solver.py
  8. +1
    -3
      test/performance/node_classification/pyg/trainer.py
  9. +1
    -1
      test/performance/node_classification/pyg/trainer_dataset.py

+ 0
- 2
autogl/module/model/encoders/_dgl/_gat.py View File

@@ -52,8 +52,6 @@ class GAT(torch.nn.Module):
def forward(
self, graph: dgl.DGLGraph, *__args, **__kwargs
) -> _typing.Iterable[torch.Tensor]:
graph = dgl.remove_self_loop(graph)
graph = dgl.add_self_loop(graph)
num_layers = len(self.__convolutions)
x: torch.Tensor = graph.ndata['feat']
results = [x]


+ 0
- 2
autogl/module/model/encoders/_dgl/_gcn.py View File

@@ -26,8 +26,6 @@ class _GCN(torch.nn.Module):
self._dropout: _typing.Optional[float] = dropout

def forward(self, graph: dgl.DGLGraph, *__args, **__kwargs):
graph = dgl.remove_self_loop(graph)
graph = dgl.add_self_loop(graph)
x: torch.Tensor = graph.ndata['feat']
results: _typing.MutableSequence[torch.Tensor] = []
for _layer in range(len(self.__convolution_layers)):


+ 1
- 1
test/performance/node_classification/dgl/helper.py View File

@@ -15,7 +15,7 @@ def get_encoder_decoder_hp(model='gin', decoder=None):
"hidden": [8],
"heads": 8,
"dropout": 0.6,
"act": "elu",
"act": "relu",
}
elif model == 'gcn':
model_hp = {


+ 6
- 6
test/performance/node_classification/dgl/model.py View File

@@ -82,8 +82,8 @@ if __name__ == '__main__':

if args.model == 'gat':
model = AutoGAT(
num_features=num_features,
num_classes=num_classes,
input_dimension=num_features,
output_dimension=num_classes,
device=args.device
).from_hyper_parameter({
# hp from model
@@ -96,8 +96,8 @@ if __name__ == '__main__':
}).model
elif args.model == 'gcn':
model = AutoGCN(
num_features=num_features,
num_classes=num_classes,
input_dimension=num_features,
output_dimension=num_classes,
device=args.device
).from_hyper_parameter({
"num_layers": 2,
@@ -107,8 +107,8 @@ if __name__ == '__main__':
}).model
elif args.model == 'sage':
model = AutoSAGE(
num_features=num_features,
num_classes=num_classes,
input_dimension=num_features,
output_dimension=num_classes,
device=args.device
).from_hyper_parameter({
"num_layers": 2,


+ 20
- 11
test/performance/node_classification/pyg/helper.py View File

@@ -1,9 +1,9 @@
def get_encoder_decoder_hp(model='gin', decoder=None):
def get_encoder_decoder_hp(model='gin', decoder=None, decoupled=False):
if model == 'gin':
model_hp = {
# hp from model
"num_layers": 5,
"hidden": [64,64,64,64],
"num_layers": 2,
"hidden": [64],
"dropout": 0.5,
"act": "relu",
"eps": "False",
@@ -11,14 +11,23 @@ def get_encoder_decoder_hp(model='gin', decoder=None):
}

if model == 'gat':
model_hp = {
"num_layers": 2,
"hidden": [8],
"num_hidden_heads": 8,
"num_output_heads": 8,
"dropout": 0.6,
"act": "elu"
}
if decoupled:
model_hp = {
"num_layers": 2,
"hidden": [8],
"num_hidden_heads": 8,
"num_output_heads": 1,
"dropout": 0.6,
"act": "elu"
}
else:
model_hp = {
"num_layers": 2,
"hidden": [8],
"heads": 8,
"dropout": 0.6,
"act": "elu"
}
elif model == 'gcn':
model_hp = {
"num_layers": 2,


+ 1
- 1
test/performance/node_classification/pyg/model_decouple.py View File

@@ -87,7 +87,7 @@ if __name__ == '__main__':

accs = []

model_hp, decoder_hp = get_encoder_decoder_hp(args.model)
model_hp, decoder_hp = get_encoder_decoder_hp(args.model, decoupled=True)

for seed in tqdm(range(args.repeat)):
set_seed(seed)


+ 1
- 1
test/performance/node_classification/pyg/solver.py View File

@@ -42,7 +42,7 @@ if __name__ == '__main__':
label = dataset[0].nodes.data['y'][dataset[0].nodes.data['test_mask']].numpy()
accs = []

model_hp, decoder_hp = get_encoder_decoder_hp(args.model)
model_hp, decoder_hp = get_encoder_decoder_hp(args.model, decoupled=True)

for seed in tqdm(range(args.repeat)):



+ 1
- 3
test/performance/node_classification/pyg/trainer.py View File

@@ -40,12 +40,10 @@ if __name__ == '__main__':

accs = []

model_hp, decoder_hp = get_encoder_decoder_hp(args.model)
model_hp, decoder_hp = get_encoder_decoder_hp(args.model, decoupled=True)
for seed in tqdm(range(args.repeat)):
set_seed(seed)

model_hp, decoder_hp = get_encoder_decoder_hp(args.model)

trainer = NodeClassificationFullTrainer(
model=args.model,
num_features=num_features,


+ 1
- 1
test/performance/node_classification/pyg/trainer_dataset.py View File

@@ -40,7 +40,7 @@ if __name__ == '__main__':

accs = []

model_hp, decoder_hp = get_encoder_decoder_hp(args.model)
model_hp, decoder_hp = get_encoder_decoder_hp(args.model, decoupled=True)
for seed in tqdm(range(args.repeat)):
set_seed(seed)



Loading…
Cancel
Save