changes
Browse files
app.py
CHANGED
|
@@ -6,6 +6,39 @@ import gradio as gr
|
|
| 6 |
import datetime
|
| 7 |
import numpy as np
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
def get_time():
|
| 10 |
return datetime.datetime.now()
|
| 11 |
|
|
@@ -39,8 +72,8 @@ with gr.Blocks() as demo:
|
|
| 39 |
"Change the value of the slider to automatically update the plot",
|
| 40 |
label="",
|
| 41 |
)
|
| 42 |
-
period = gr.
|
| 43 |
-
label="
|
| 44 |
)
|
| 45 |
plot = gr.LinePlot(show_label=False)
|
| 46 |
with gr.Column():
|
|
@@ -51,7 +84,7 @@ with gr.Blocks() as demo:
|
|
| 51 |
|
| 52 |
demo.load(lambda: datetime.datetime.now(), None, c_time2, every=1)
|
| 53 |
dep = demo.load(get_plot, None, plot, every=1)
|
| 54 |
-
period.
|
| 55 |
|
| 56 |
if __name__ == "__main__":
|
| 57 |
demo.queue().launch()
|
|
|
|
| 6 |
import datetime
|
| 7 |
import numpy as np
|
| 8 |
|
| 9 |
+
# from dgl.data import YelpDataset
|
| 10 |
+
|
| 11 |
+
# import dgl
|
| 12 |
+
# import torch as th
|
| 13 |
+
|
| 14 |
+
# from dgl.dataloading import LaborSampler, NeighborSampler
|
| 15 |
+
|
| 16 |
+
# data = YelpDataset()
|
| 17 |
+
|
| 18 |
+
# device = 'cuda:0'
|
| 19 |
+
|
| 20 |
+
# g = data[0].to(device)
|
| 21 |
+
|
| 22 |
+
# num_layers = 3
|
| 23 |
+
|
| 24 |
+
# fanouts = [10] * num_layers
|
| 25 |
+
|
| 26 |
+
# samplers = [LaborSampler(fanouts, importance_sampling=1), LaborSampler(fanouts, importance_sampling=0), NeighborSampler(fanouts)]
|
| 27 |
+
|
| 28 |
+
# names = ['LABOR-1', 'LABOR-0', 'NS']
|
| 29 |
+
|
| 30 |
+
# indices = th.arange(g.num_nodes()).to(device)
|
| 31 |
+
|
| 32 |
+
# loaders = [dgl.dataloading.DataLoader(g, indices, sampler, batch_size=1024, shuffle=True, drop_last=True) for sampler in samplers]
|
| 33 |
+
|
| 34 |
+
# results = []
|
| 35 |
+
|
| 36 |
+
# for sampled in zip(*loaders):
|
| 37 |
+
# numbers.append([s[0].shape for s in sampled])
|
| 38 |
+
# print(numbers[-1])
|
| 39 |
+
|
| 40 |
+
# th.tensor(numbers).mean(dim=0, dtype=th.float64)
|
| 41 |
+
|
| 42 |
def get_time():
|
| 43 |
return datetime.datetime.now()
|
| 44 |
|
|
|
|
| 72 |
"Change the value of the slider to automatically update the plot",
|
| 73 |
label="",
|
| 74 |
)
|
| 75 |
+
period = gr.Number(
|
| 76 |
+
label="batch size", value=1024, show_label=True
|
| 77 |
)
|
| 78 |
plot = gr.LinePlot(show_label=False)
|
| 79 |
with gr.Column():
|
|
|
|
| 84 |
|
| 85 |
demo.load(lambda: datetime.datetime.now(), None, c_time2, every=1)
|
| 86 |
dep = demo.load(get_plot, None, plot, every=1)
|
| 87 |
+
period.submit(get_plot, period, plot, every=1, cancels=[dep])
|
| 88 |
|
| 89 |
if __name__ == "__main__":
|
| 90 |
demo.queue().launch()
|