File size: 4,349 Bytes
734ca59
28dd0d5
 
 
 
976eb10
 
 
0dfa35f
734ca59
0dfa35f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
734ca59
0dfa35f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
734ca59
 
 
 
01593e1
7aef7b8
 
 
 
 
28dd0d5
d63c8d0
0dfa35f
cb89f67
e589f54
 
cb89f67
734ca59
31b8889
0dfa35f
28dd0d5
 
 
7aef7b8
28dd0d5
7c04b7a
9a8c083
 
 
 
 
7fa6af3
 
01593e1
7fa6af3
9a8c083
28dd0d5
7aef7b8
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import functools
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

import gradio as gr


BENCHMARK_DATA = {
    "Greedy Search": {
        "DistilGPT2": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "GPT2": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "OPT-1.3B": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "GPTJ-6B": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "T5 Small": {
            "T4": [1, 2, 3, 4],
            "3090": [],
            "A100": [],
        },
        "T5 Base": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "T5 Large": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "T5 3B": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
    },
    "Sample": {
        "DistilGPT2": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "GPT2": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "OPT-1.3B": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "GPTJ-6B": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "T5 Small": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "T5 Base": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "T5 Large": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "T5 3B": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
    },
    "Beam Search": {
        "DistilGPT2": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "GPT2": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "OPT-1.3B": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "GPTJ-6B": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "T5 Small": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "T5 Base": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "T5 Large": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
        "T5 3B": {
            "T4": [],
            "3090": [],
            "A100": [],
        },
    },
}


def get_plot(model_name, generate_type):
    data = BENCHMARK_DATA[generate_type][model_name]["T4"]
    plt.plot(data)
    plt.title(model_name)
    return plt.gcf()

demo = gr.Blocks()

with demo:
    with gr.Tabs():
        with gr.TabItem("Greedy Search"):
            model_selector = gr.Dropdown(
                choices=["DistilGPT2", "GPT2", "OPT-1.3B", "GPTJ-6B", "T5 Small", "T5 Base", "T5 Large", "T5 3B"],
                value="T5 Small",
                label="Model",
                interactive=True,
            )
            plot_fn = functools.partial(get_plot, generate_type="Greedy Search")
            plot = gr.Plot(value=plot_fn("T5 Small"))  # Show plot when the gradio app is initialized
            model_selector.change(fn=get_plot, inputs=[model_selector], outputs=plot)
        with gr.TabItem("Sample"):
            gr.Button("New Tiger")
        with gr.TabItem("Beam Search"):
            gr.Button("New Tiger")
        with gr.TabItem("Benchmark Information"):
            gr.Dataframe(
                headers=["Parameter", "Value"],
                value=[
                    ["Transformers Version", "4.22.dev0"],
                    ["TensorFlow Version", "2.9.1"],
                    ["Pytorch Version", "1.11.0"],
                    ["OS", "22.04 LTS (3090) / Debian 10 (other GPUs)"],
                    ["CUDA", "11.6 (3090) / 11.3 (others GPUs)"],
                    ["Number of runs", "100 (the first run was discarded to ignore compilation time)"],
                    ["Is there code to reproduce?", "Yes -- https://gist.github.com/gante/f0017e3f13ac11b0c02e4e4db351f52f"],
                ],
            )

demo.launch()