Spaces:
Running
Running
Commit
Β·
5468ec9
1
Parent(s):
0f9db6d
update
Browse files- app.py +49 -36
- packages.txt +1 -0
app.py
CHANGED
|
@@ -107,41 +107,53 @@ def run_benchmark(kwargs, oauth_token: gr.OAuthToken):
|
|
| 107 |
**configs["ipex"],
|
| 108 |
)
|
| 109 |
|
| 110 |
-
|
|
|
|
|
|
|
| 111 |
|
| 112 |
-
yield
|
| 113 |
|
| 114 |
timestamp = time.strftime("%Y-%m-%d-%H-%M-%S")
|
| 115 |
|
| 116 |
for backend in backends:
|
| 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 |
def build_demo():
|
|
@@ -194,6 +206,10 @@ def build_demo():
|
|
| 194 |
with gr.Accordion(label="Process Config", open=False, visible=True):
|
| 195 |
process_config = get_process_config()
|
| 196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
with gr.Row() as backend_configs:
|
| 198 |
with gr.Accordion(label="OnnxRuntime Config", open=False, visible=True):
|
| 199 |
onnxruntime_config = get_onnxruntime_config()
|
|
@@ -213,13 +229,10 @@ def build_demo():
|
|
| 213 |
)
|
| 214 |
|
| 215 |
with gr.Row():
|
| 216 |
-
|
| 217 |
-
inference_config = get_inference_config()
|
| 218 |
-
|
| 219 |
-
button = gr.Button(value="Run Benchmark", variant="primary")
|
| 220 |
|
| 221 |
with gr.Row():
|
| 222 |
-
|
| 223 |
|
| 224 |
button.click(
|
| 225 |
fn=run_benchmark,
|
|
@@ -234,7 +247,7 @@ def build_demo():
|
|
| 234 |
*pytorch_config.values(),
|
| 235 |
*ipex_config.values(),
|
| 236 |
},
|
| 237 |
-
outputs=[
|
| 238 |
concurrency_limit=1,
|
| 239 |
)
|
| 240 |
|
|
|
|
| 107 |
**configs["ipex"],
|
| 108 |
)
|
| 109 |
|
| 110 |
+
md_output = (
|
| 111 |
+
f"<h3>Running benchmark for model {model} on task {task} with {backends}</h3>"
|
| 112 |
+
)
|
| 113 |
|
| 114 |
+
yield md_output
|
| 115 |
|
| 116 |
timestamp = time.strftime("%Y-%m-%d-%H-%M-%S")
|
| 117 |
|
| 118 |
for backend in backends:
|
| 119 |
+
md_output += f"<br>π Launching benchmark for {backend}"
|
| 120 |
+
yield md_output
|
| 121 |
+
|
| 122 |
+
try:
|
| 123 |
+
benchmark_name = f"{timestamp}/{backend}"
|
| 124 |
+
benchmark_config = BenchmarkConfig(
|
| 125 |
+
name=benchmark_name,
|
| 126 |
+
backend=configs[backend],
|
| 127 |
+
launcher=configs[LAUNCHER],
|
| 128 |
+
scenario=configs[SCENARIO],
|
| 129 |
+
)
|
| 130 |
+
benchmark_config.push_to_hub(
|
| 131 |
+
repo_id=f"{username}/benchmarks",
|
| 132 |
+
subfolder=benchmark_name,
|
| 133 |
+
token=oauth_token.token,
|
| 134 |
+
)
|
| 135 |
+
benchmark_report = Benchmark.launch(benchmark_config)
|
| 136 |
+
benchmark_report.push_to_hub(
|
| 137 |
+
repo_id=f"{username}/benchmarks",
|
| 138 |
+
subfolder=benchmark_name,
|
| 139 |
+
token=oauth_token.token,
|
| 140 |
+
)
|
| 141 |
+
benchmark = Benchmark(config=benchmark_config, report=benchmark_report)
|
| 142 |
+
benchmark.push_to_hub(
|
| 143 |
+
repo_id=f"{username}/benchmarks",
|
| 144 |
+
subfolder=benchmark_name,
|
| 145 |
+
token=oauth_token.token,
|
| 146 |
+
)
|
| 147 |
+
|
| 148 |
+
md_output += (
|
| 149 |
+
f"<br>β
Benchmark for {backend} backend completed successfully"
|
| 150 |
+
)
|
| 151 |
+
yield md_output
|
| 152 |
+
except Exception as e:
|
| 153 |
+
md_output += (
|
| 154 |
+
f"<br>β Error while running benchmark for {backend} backend: {e}"
|
| 155 |
+
)
|
| 156 |
+
yield md_output
|
| 157 |
|
| 158 |
|
| 159 |
def build_demo():
|
|
|
|
| 206 |
with gr.Accordion(label="Process Config", open=False, visible=True):
|
| 207 |
process_config = get_process_config()
|
| 208 |
|
| 209 |
+
with gr.Row():
|
| 210 |
+
with gr.Accordion(label="Scenario Config", open=False, visible=True):
|
| 211 |
+
inference_config = get_inference_config()
|
| 212 |
+
|
| 213 |
with gr.Row() as backend_configs:
|
| 214 |
with gr.Accordion(label="OnnxRuntime Config", open=False, visible=True):
|
| 215 |
onnxruntime_config = get_onnxruntime_config()
|
|
|
|
| 229 |
)
|
| 230 |
|
| 231 |
with gr.Row():
|
| 232 |
+
button = gr.Button(value="Run Benchmark", variant="primary")
|
|
|
|
|
|
|
|
|
|
| 233 |
|
| 234 |
with gr.Row():
|
| 235 |
+
md_output = gr.Markdown(label="Output", value="")
|
| 236 |
|
| 237 |
button.click(
|
| 238 |
fn=run_benchmark,
|
|
|
|
| 247 |
*pytorch_config.values(),
|
| 248 |
*ipex_config.values(),
|
| 249 |
},
|
| 250 |
+
outputs=[md_output],
|
| 251 |
concurrency_limit=1,
|
| 252 |
)
|
| 253 |
|
packages.txt
CHANGED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
numactl
|