Unverified Commit 1ac70abb authored by xiang song(charlie.song)'s avatar xiang song(charlie.song) Committed by GitHub
Browse files

[Test] Update unsupervised regression speed test (#2460)



* Add sage neighbor sample test for reddit

* Add ogbn-products dataset

* upd

* upd

* use symbolic other than copy data for ogb datasets

* upd

* upd

* Add graphsage unsupervised neighbor sampler

* update unsupervised

* upd

* upd
Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-59-204.ec2.internal>
Co-authored-by: default avatarMinjie Wang <wmjlyjemaine@gmail.com>
parent 927d2b31
...@@ -89,8 +89,8 @@ class CrossEntropyLoss(nn.Module): ...@@ -89,8 +89,8 @@ class CrossEntropyLoss(nn.Module):
loss = F.binary_cross_entropy_with_logits(score, label.float()) loss = F.binary_cross_entropy_with_logits(score, label.float())
return loss return loss
@utils.benchmark('time', 3600) @utils.benchmark('time', 72000)
@utils.parametrize('data', ['reddit', 'ogbn-products']) @utils.parametrize('data', ['reddit'])
def track_time(data): def track_time(data):
data = utils.process_data(data) data = utils.process_data(data)
device = utils.get_bench_device() device = utils.get_bench_device()
...@@ -104,17 +104,15 @@ def track_time(data): ...@@ -104,17 +104,15 @@ def track_time(data):
# This avoids creating certain formats in each sub-process, which saves momory and CPU. # This avoids creating certain formats in each sub-process, which saves momory and CPU.
g.create_formats_() g.create_formats_()
num_epochs = 5 num_epochs = 2
num_hidden = 16 num_hidden = 16
num_layers = 2 num_layers = 2
fan_out = '10,25' fan_out = '10,25'
batch_size = 1024 batch_size = 10000
lr = 0.003 lr = 0.003
dropout = 0.5 dropout = 0.5
num_workers = 4 num_workers = 0
num_negs = 4 num_negs = 2
train_nid = th.nonzero(g.ndata['train_mask'], as_tuple=True)[0]
n_edges = g.number_of_edges() n_edges = g.number_of_edges()
train_seeds = np.arange(n_edges) train_seeds = np.arange(n_edges)
...@@ -142,22 +140,6 @@ def track_time(data): ...@@ -142,22 +140,6 @@ def track_time(data):
loss_fcn = loss_fcn.to(device) loss_fcn = loss_fcn.to(device)
optimizer = optim.Adam(model.parameters(), lr=lr) optimizer = optim.Adam(model.parameters(), lr=lr)
# dry run one epoch
for step, (input_nodes, pos_graph, neg_graph, blocks) in enumerate(dataloader):
# Load the input features as well as output labels
#batch_inputs, batch_labels = load_subtensor(g, seeds, input_nodes, device)
batch_inputs = load_subtensor(g, input_nodes, device)
pos_graph = pos_graph.to(device)
neg_graph = neg_graph.to(device)
blocks = [block.int().to(device) for block in blocks]
# Compute loss and prediction
batch_pred = model(blocks, batch_inputs)
loss = loss_fcn(batch_pred, pos_graph, neg_graph)
optimizer.zero_grad()
loss.backward()
optimizer.step()
# Training loop # Training loop
avg = 0 avg = 0
iter_tput = [] iter_tput = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment