Skip to content

Commit 30a838d

Browse files
authored
Fixed bug in examples that failed integration tests (#412)
* Fixed bug in examples that failed integration tests * Increased time budget for base3 and edgebank integration tests * Increase time budget for tkgl edgebank
1 parent aadb103 commit 30a838d

9 files changed

Lines changed: 20 additions & 10 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,6 @@ submitit*
166166

167167
# Benchmarks
168168
.benchmarks
169+
170+
# TGB-seq data cache
171+
data/

examples/graphproppred/gcn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def eval(
317317
log_metrics_dict(train_results, epoch=epoch)
318318
log_metrics_dict(val_results, epoch=epoch)
319319

320-
val_score = val_results['BinaryAUROC']
320+
val_score = val_results['ValidationBinaryAUROC']
321321
if val_score > best_val:
322322
best_val = val_score
323323
test_results = eval(test_loader, test_labels, encoder, decoder, test_metrics)

examples/graphproppred/tgcn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def eval(
298298
log_metrics_dict(train_results, epoch=epoch)
299299
log_metrics_dict(val_results, epoch=epoch)
300300

301-
val_score = val_results['BinaryAUROC']
301+
val_score = val_results['ValidationBinaryAUROC']
302302
if val_score > best_val:
303303
best_val = val_score
304304
test_results, h_0 = eval(

examples/linkproppred/ctan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def compute_delta_t_stats(train_dg: DGraph) -> Tuple[float, float]:
234234
)
235235
train_key, val_key, test_key = hm.keys
236236
hm.register_shared(nbr_hook)
237-
hm.register_shared(DeduplicationHook())
237+
hm.register_shared(DeduplicationHook(seed_nodes_keys=['neg', 'nbr_nids']))
238238

239239
train_loader = DGDataLoader(train_dg, args.bsize, hook_manager=hm)
240240
val_loader = DGDataLoader(val_dg, args.bsize, hook_manager=hm)

examples/linkproppred/roland.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def eval(
204204
except StopIteration:
205205
pass
206206

207-
z = z.detach()
207+
z[0], z[1] = z[0].detach(), z[1].detach()
208208
return float(np.mean(perf_list)), z
209209

210210

examples/linkproppred/tgb_seq/edgebank.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import argparse
2+
from typing import Set
23

34
import numpy as np
45
import torch
@@ -64,7 +65,13 @@ def eval(
6465

6566

6667
class TGBSEQ_NegativeEdgeSamplerHook(StatelessHook):
67-
produces = {'neg', 'neg_time'}
68+
@property
69+
def produces(self) -> Set[str]:
70+
return {'neg', 'neg_time'}
71+
72+
@property
73+
def requires(self) -> Set[str]:
74+
return {'edge_src', 'edge_dst', 'edge_time'}
6875

6976
def __init__(
7077
self, dataset_name: str, split_mode: str, dgraph: DGraph, root: str = './data'

test/integration/test_base3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'--partition=main',
99
'--cpus-per-task=2',
1010
'--mem=4G',
11-
'--time=0:05:00',
11+
'--time=0:20:00',
1212
]
1313
)
1414
def test_base3_linkprop_inf_EB_memory(slurm_job_runner, dataset):

test/integration/test_edgebank.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_edgebank_linkprop_pred_fixed_memory(slurm_job_runner, dataset):
4444
'--partition=main',
4545
'--cpus-per-task=2',
4646
'--mem=8G',
47-
'--time=0:15:00',
47+
'--time=0:25:00',
4848
]
4949
)
5050
def test_edgebank_tgb_seq_unlimited_memory(slurm_job_runner, dataset):
@@ -98,7 +98,7 @@ def test_edgebank_linkprop_pred_fixed_memory_thgl(slurm_job_runner, dataset):
9898
'--partition=main',
9999
'--cpus-per-task=2',
100100
'--mem=8G',
101-
'--time=1:15:00',
101+
'--time=3:00:00',
102102
]
103103
)
104104
def test_edgebank_linkprop_pred_unlimited_memory_tkgl(slurm_job_runner, dataset):
@@ -116,7 +116,7 @@ def test_edgebank_linkprop_pred_unlimited_memory_tkgl(slurm_job_runner, dataset)
116116
'--partition=main',
117117
'--cpus-per-task=2',
118118
'--mem=8G',
119-
'--time=2:00:00',
119+
'--time=4:00:00',
120120
]
121121
)
122122
def test_edgebank_linkprop_pred_fixed_memory_tkgl(slurm_job_runner, dataset):

tgm/hooks/hook_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def activate(self, key: str) -> Iterator[None]:
210210
def _ensure_valid_hook(self, hook: Any) -> None:
211211
if not isinstance(hook, DGHook):
212212
raise BadHookProtocolError(
213-
f'Cannot register hook {type(hook).__name__}: must implement __call__(dg: DGraph, batch: DGBatch) -> DGBatch and reset_state()'
213+
f'Cannot register hook {type(hook).__name__}: must implement __call__(dg: DGraph, batch: DGBatch) -> DGBatch, reset_state(), requires and produces properties.'
214214
)
215215

216216
def _ensure_no_active_key(self) -> None:

0 commit comments

Comments
 (0)