playing around with gradio
Browse files
app.py
CHANGED
@@ -9,6 +9,136 @@ import gradio as gr
|
|
9 |
dummy_data = [1, 2, 3, 4]
|
10 |
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
def get_plot(model_name):
|
13 |
plt.plot(dummy_data)
|
14 |
plt.legend(model_name)
|
@@ -20,12 +150,13 @@ with demo:
|
|
20 |
with gr.Tabs():
|
21 |
with gr.TabItem("Greedy Search"):
|
22 |
model_selector = gr.Dropdown(
|
23 |
-
choices=["DistilGPT2", "GPT2", "OPT
|
24 |
value="T5 Small",
|
25 |
label="Model",
|
26 |
interactive=True,
|
27 |
)
|
28 |
-
|
|
|
29 |
with gr.TabItem("Sample"):
|
30 |
gr.Button("New Tiger")
|
31 |
with gr.TabItem("Beam Search"):
|
|
|
9 |
dummy_data = [1, 2, 3, 4]
|
10 |
|
11 |
|
12 |
+
BENCHMARK_DATA = {
|
13 |
+
"Greedy": {
|
14 |
+
"DistilGPT2": {
|
15 |
+
"T4": [],
|
16 |
+
"3090": [],
|
17 |
+
"A100": [],
|
18 |
+
},
|
19 |
+
"GPT2": {
|
20 |
+
"T4": [],
|
21 |
+
"3090": [],
|
22 |
+
"A100": [],
|
23 |
+
},
|
24 |
+
"OPT-1.3B": {
|
25 |
+
"T4": [],
|
26 |
+
"3090": [],
|
27 |
+
"A100": [],
|
28 |
+
},
|
29 |
+
"GPTJ-6B": {
|
30 |
+
"T4": [],
|
31 |
+
"3090": [],
|
32 |
+
"A100": [],
|
33 |
+
},
|
34 |
+
"T5 Small": {
|
35 |
+
"T4": [],
|
36 |
+
"3090": [],
|
37 |
+
"A100": [],
|
38 |
+
},
|
39 |
+
"T5 Base": {
|
40 |
+
"T4": [],
|
41 |
+
"3090": [],
|
42 |
+
"A100": [],
|
43 |
+
},
|
44 |
+
"T5 Large": {
|
45 |
+
"T4": [],
|
46 |
+
"3090": [],
|
47 |
+
"A100": [],
|
48 |
+
},
|
49 |
+
"T5 3B": {
|
50 |
+
"T4": [],
|
51 |
+
"3090": [],
|
52 |
+
"A100": [],
|
53 |
+
},
|
54 |
+
},
|
55 |
+
"Sample": {
|
56 |
+
"DistilGPT2": {
|
57 |
+
"T4": [],
|
58 |
+
"3090": [],
|
59 |
+
"A100": [],
|
60 |
+
},
|
61 |
+
"GPT2": {
|
62 |
+
"T4": [],
|
63 |
+
"3090": [],
|
64 |
+
"A100": [],
|
65 |
+
},
|
66 |
+
"OPT-1.3B": {
|
67 |
+
"T4": [],
|
68 |
+
"3090": [],
|
69 |
+
"A100": [],
|
70 |
+
},
|
71 |
+
"GPTJ-6B": {
|
72 |
+
"T4": [],
|
73 |
+
"3090": [],
|
74 |
+
"A100": [],
|
75 |
+
},
|
76 |
+
"T5 Small": {
|
77 |
+
"T4": [],
|
78 |
+
"3090": [],
|
79 |
+
"A100": [],
|
80 |
+
},
|
81 |
+
"T5 Base": {
|
82 |
+
"T4": [],
|
83 |
+
"3090": [],
|
84 |
+
"A100": [],
|
85 |
+
},
|
86 |
+
"T5 Large": {
|
87 |
+
"T4": [],
|
88 |
+
"3090": [],
|
89 |
+
"A100": [],
|
90 |
+
},
|
91 |
+
"T5 3B": {
|
92 |
+
"T4": [],
|
93 |
+
"3090": [],
|
94 |
+
"A100": [],
|
95 |
+
},
|
96 |
+
},
|
97 |
+
"Beam Search": {
|
98 |
+
"DistilGPT2": {
|
99 |
+
"T4": [],
|
100 |
+
"3090": [],
|
101 |
+
"A100": [],
|
102 |
+
},
|
103 |
+
"GPT2": {
|
104 |
+
"T4": [],
|
105 |
+
"3090": [],
|
106 |
+
"A100": [],
|
107 |
+
},
|
108 |
+
"OPT-1.3B": {
|
109 |
+
"T4": [],
|
110 |
+
"3090": [],
|
111 |
+
"A100": [],
|
112 |
+
},
|
113 |
+
"GPTJ-6B": {
|
114 |
+
"T4": [],
|
115 |
+
"3090": [],
|
116 |
+
"A100": [],
|
117 |
+
},
|
118 |
+
"T5 Small": {
|
119 |
+
"T4": [],
|
120 |
+
"3090": [],
|
121 |
+
"A100": [],
|
122 |
+
},
|
123 |
+
"T5 Base": {
|
124 |
+
"T4": [],
|
125 |
+
"3090": [],
|
126 |
+
"A100": [],
|
127 |
+
},
|
128 |
+
"T5 Large": {
|
129 |
+
"T4": [],
|
130 |
+
"3090": [],
|
131 |
+
"A100": [],
|
132 |
+
},
|
133 |
+
"T5 3B": {
|
134 |
+
"T4": [],
|
135 |
+
"3090": [],
|
136 |
+
"A100": [],
|
137 |
+
},
|
138 |
+
},
|
139 |
+
}
|
140 |
+
|
141 |
+
|
142 |
def get_plot(model_name):
|
143 |
plt.plot(dummy_data)
|
144 |
plt.legend(model_name)
|
|
|
150 |
with gr.Tabs():
|
151 |
with gr.TabItem("Greedy Search"):
|
152 |
model_selector = gr.Dropdown(
|
153 |
+
choices=["DistilGPT2", "GPT2", "OPT-1.3B", "GPTJ-6B", "T5 Small", "T5 Base", "T5 Large", "T5 3B"],
|
154 |
value="T5 Small",
|
155 |
label="Model",
|
156 |
interactive=True,
|
157 |
)
|
158 |
+
plot = gr.Plot()
|
159 |
+
model_selector.change(fn=get_plot, inputs=[model_selector], outputs=plot)
|
160 |
with gr.TabItem("Sample"):
|
161 |
gr.Button("New Tiger")
|
162 |
with gr.TabItem("Beam Search"):
|