co42 HF staff commited on
Commit
f0c710b
·
verified ·
1 Parent(s): 7a65d98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +115 -125
app.py CHANGED
@@ -1,6 +1,3 @@
1
- import signal
2
- import os
3
-
4
  import gradio as gr
5
 
6
  import src.dependency # noqa
@@ -8,17 +5,17 @@ from src.assets import custom_css
8
 
9
  # from src.attention import create_attn_plots
10
  from src.content import ABOUT, CITATION_BUTTON, CITATION_BUTTON_LABEL, LOGO, TITLE
11
- from src.hardware import load_hardware_configs
12
- from src.leaderboard import create_leaderboard_table
13
- from src.llm_perf import get_llm_perf_df
14
- from src.map import create_lat_score_mem_plot
15
- from src.panel import (
16
- create_control_callback,
17
- create_control_panel,
18
- create_select_callback,
19
- )
20
 
21
- configs = load_hardware_configs("hardware.yaml")
22
 
23
 
24
  demo = gr.Blocks(
@@ -28,122 +25,115 @@ demo = gr.Blocks(
28
  with demo:
29
  gr.HTML(LOGO, elem_classes="logo")
30
  gr.HTML(TITLE, elem_classes="title")
31
- ####################### HARDWARE TABS #######################
32
- with gr.Tabs(elem_classes="tabs"):
33
- for id, config in enumerate(configs):
34
- with gr.TabItem(config.description, id=id):
35
- ####################### HARDWARE DETAILS #######################
36
- if config.detail:
37
- gr.Markdown(config.detail, elem_classes="descriptive-text")
38
-
39
- # ####################### CONTROL PANEL #######################
40
- (
41
- filter_button,
42
- machine_value,
43
- subsets_value,
44
- backends_value,
45
- hardware_type_value,
46
- score_slider,
47
- memory_slider,
48
- backend_checkboxes,
49
- datatype_checkboxes,
50
- optimization_checkboxes,
51
- quantization_checkboxes,
52
- kernels_checkboxes,
53
- ) = create_control_panel(
54
- machine=config.machine,
55
- subsets=config.subsets,
56
- backends=config.backends,
57
- hardware_type=config.hardware_type,
58
- hardware_provider=config.hardware_provider,
59
- )
60
- ####################### HARDWARE SUBTABS #######################
61
- with gr.Tabs(elem_classes="subtabs"):
62
- open_llm_perf_df = get_llm_perf_df(
63
- machine=config.machine,
64
- subsets=config.subsets,
65
- backends=config.backends,
66
- hardware_type=config.hardware_type,
67
- )
68
- ####################### LEADERBOARD TAB #######################
69
- with gr.TabItem("Leaderboard 🏅", id=0):
70
- search_bar, columns_checkboxes, leaderboard_table = (
71
- create_leaderboard_table(open_llm_perf_df)
72
- )
73
- with gr.TabItem("Find Your Best Model 🧭", id=1):
74
- lat_score_mem_plot = create_lat_score_mem_plot(
75
- open_llm_perf_df
76
- )
77
- ###################### ATTENTIONS SPEEDUP TAB #######################
78
- # with gr.TabItem("Attention 📈", id=2):
79
- # attn_prefill_plot, attn_decode_plot = create_attn_plots(
80
- # open_llm_perf_df
81
- # )
82
- # ####################### KERNELS SPEEDUP TAB #######################
83
- # with gr.TabItem("Kernels 📈", id=4):
84
- # quant_krnl_prefill_plot, quant_krnl_decode_plot = (
85
- # create_quant_krnl_plots(llm_perf_df)
86
- # )
87
 
88
- ####################### CONTROL CALLBACK #######################
89
- create_control_callback(
90
- filter_button,
91
- # inputs
92
- machine_value,
93
- subsets_value,
94
- backends_value,
95
- hardware_type_value,
96
- score_slider,
97
- memory_slider,
98
- backend_checkboxes,
99
- datatype_checkboxes,
100
- optimization_checkboxes,
101
- quantization_checkboxes,
102
- kernels_checkboxes,
103
- # interactive
104
- columns_checkboxes,
105
- search_bar,
106
- # outputs
107
- leaderboard_table,
108
- lat_score_mem_plot,
109
- # attn_prefill_plot,
110
- # attn_decode_plot,
111
- # quant_krnl_prefill_plot,
112
- # quant_krnl_decode_plot,
113
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
- create_select_callback(
116
- # inputs
117
- machine_value,
118
- subsets_value,
119
- backends_value,
120
- hardware_type_value,
121
- # interactive
122
- columns_checkboxes,
123
- search_bar,
124
- # outputs
125
- leaderboard_table,
126
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
- ####################### ABOUT TAB #######################
129
- with gr.TabItem("About 📖", id=len(configs)):
130
- gr.Markdown(ABOUT, elem_classes="descriptive-text")
131
- ####################### CITATION
132
- with gr.Row():
133
- with gr.Accordion("📙 Citation", open=False):
134
- citation_button = gr.Textbox(
135
- value=CITATION_BUTTON,
136
- label=CITATION_BUTTON_LABEL,
137
- elem_id="citation-button",
138
- show_copy_button=True,
139
- )
140
 
141
- def tracefunc(frame, event, arg):
142
- if event == 'call':
143
- print(f"Calling function: {frame.f_code.co_name}")
144
- return tracefunc
 
 
 
 
 
 
 
 
145
 
146
  if __name__ == "__main__":
147
- import sys
148
- sys.settrace(tracefunc)
149
  demo.queue().launch(ssr_mode=False)
 
 
 
 
1
  import gradio as gr
2
 
3
  import src.dependency # noqa
 
5
 
6
  # from src.attention import create_attn_plots
7
  from src.content import ABOUT, CITATION_BUTTON, CITATION_BUTTON_LABEL, LOGO, TITLE
8
+ # from src.hardware import load_hardware_configs
9
+ # from src.leaderboard import create_leaderboard_table
10
+ # from src.llm_perf import get_llm_perf_df
11
+ # from src.map import create_lat_score_mem_plot
12
+ # from src.panel import (
13
+ # create_control_callback,
14
+ # create_control_panel,
15
+ # create_select_callback,
16
+ # )
17
 
18
+ # configs = load_hardware_configs("hardware.yaml")
19
 
20
 
21
  demo = gr.Blocks(
 
25
  with demo:
26
  gr.HTML(LOGO, elem_classes="logo")
27
  gr.HTML(TITLE, elem_classes="title")
28
+ # ####################### HARDWARE TABS #######################
29
+ # with gr.Tabs(elem_classes="tabs"):
30
+ # for id, config in enumerate(configs):
31
+ # with gr.TabItem(config.description, id=id):
32
+ # ####################### HARDWARE DETAILS #######################
33
+ # if config.detail:
34
+ # gr.Markdown(config.detail, elem_classes="descriptive-text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
+ # # ####################### CONTROL PANEL #######################
37
+ # (
38
+ # filter_button,
39
+ # machine_value,
40
+ # subsets_value,
41
+ # backends_value,
42
+ # hardware_type_value,
43
+ # score_slider,
44
+ # memory_slider,
45
+ # backend_checkboxes,
46
+ # datatype_checkboxes,
47
+ # optimization_checkboxes,
48
+ # quantization_checkboxes,
49
+ # kernels_checkboxes,
50
+ # ) = create_control_panel(
51
+ # machine=config.machine,
52
+ # subsets=config.subsets,
53
+ # backends=config.backends,
54
+ # hardware_type=config.hardware_type,
55
+ # hardware_provider=config.hardware_provider,
56
+ # )
57
+ # ####################### HARDWARE SUBTABS #######################
58
+ # with gr.Tabs(elem_classes="subtabs"):
59
+ # open_llm_perf_df = get_llm_perf_df(
60
+ # machine=config.machine,
61
+ # subsets=config.subsets,
62
+ # backends=config.backends,
63
+ # hardware_type=config.hardware_type,
64
+ # )
65
+ # ####################### LEADERBOARD TAB #######################
66
+ # with gr.TabItem("Leaderboard 🏅", id=0):
67
+ # search_bar, columns_checkboxes, leaderboard_table = (
68
+ # create_leaderboard_table(open_llm_perf_df)
69
+ # )
70
+ # with gr.TabItem("Find Your Best Model 🧭", id=1):
71
+ # lat_score_mem_plot = create_lat_score_mem_plot(
72
+ # open_llm_perf_df
73
+ # )
74
+ # ###################### ATTENTIONS SPEEDUP TAB #######################
75
+ # # with gr.TabItem("Attention 📈", id=2):
76
+ # # attn_prefill_plot, attn_decode_plot = create_attn_plots(
77
+ # # open_llm_perf_df
78
+ # # )
79
+ # # ####################### KERNELS SPEEDUP TAB #######################
80
+ # # with gr.TabItem("Kernels 📈", id=4):
81
+ # # quant_krnl_prefill_plot, quant_krnl_decode_plot = (
82
+ # # create_quant_krnl_plots(llm_perf_df)
83
+ # # )
84
 
85
+ # ####################### CONTROL CALLBACK #######################
86
+ # create_control_callback(
87
+ # filter_button,
88
+ # # inputs
89
+ # machine_value,
90
+ # subsets_value,
91
+ # backends_value,
92
+ # hardware_type_value,
93
+ # score_slider,
94
+ # memory_slider,
95
+ # backend_checkboxes,
96
+ # datatype_checkboxes,
97
+ # optimization_checkboxes,
98
+ # quantization_checkboxes,
99
+ # kernels_checkboxes,
100
+ # # interactive
101
+ # columns_checkboxes,
102
+ # search_bar,
103
+ # # outputs
104
+ # leaderboard_table,
105
+ # lat_score_mem_plot,
106
+ # # attn_prefill_plot,
107
+ # # attn_decode_plot,
108
+ # # quant_krnl_prefill_plot,
109
+ # # quant_krnl_decode_plot,
110
+ # )
111
 
112
+ # create_select_callback(
113
+ # # inputs
114
+ # machine_value,
115
+ # subsets_value,
116
+ # backends_value,
117
+ # hardware_type_value,
118
+ # # interactive
119
+ # columns_checkboxes,
120
+ # search_bar,
121
+ # # outputs
122
+ # leaderboard_table,
123
+ # )
124
 
125
+ # ####################### ABOUT TAB #######################
126
+ # with gr.TabItem("About 📖", id=len(configs)):
127
+ # gr.Markdown(ABOUT, elem_classes="descriptive-text")
128
+ # ####################### CITATION
129
+ # with gr.Row():
130
+ # with gr.Accordion("📙 Citation", open=False):
131
+ # citation_button = gr.Textbox(
132
+ # value=CITATION_BUTTON,
133
+ # label=CITATION_BUTTON_LABEL,
134
+ # elem_id="citation-button",
135
+ # show_copy_button=True,
136
+ # )
137
 
138
  if __name__ == "__main__":
 
 
139
  demo.queue().launch(ssr_mode=False)