Spaces:
Runtime error
Runtime error
Commit
·
4d99b49
1
Parent(s):
10c3b6b
auto task
Browse files
app.py
CHANGED
|
@@ -29,10 +29,11 @@ DEVICE = "cpu"
|
|
| 29 |
LAUNCHER = "process"
|
| 30 |
SCENARIO = "inference"
|
| 31 |
BACKENDS = ["pytorch", "openvino"]
|
| 32 |
-
MODELS = [
|
| 33 |
-
|
| 34 |
-
"
|
| 35 |
-
|
|
|
|
| 36 |
TASKS = set(TASKS_TO_OVMODEL.keys()) & set(TASKS_TO_MODEL_LOADERS.keys())
|
| 37 |
|
| 38 |
|
|
@@ -157,6 +158,7 @@ def build_demo():
|
|
| 157 |
value="feature-extraction",
|
| 158 |
info="Task to run the benchmark on.",
|
| 159 |
)
|
|
|
|
| 160 |
backends = gr.CheckboxGroup(
|
| 161 |
interactive=True,
|
| 162 |
label="backends",
|
|
@@ -168,7 +170,6 @@ def build_demo():
|
|
| 168 |
with gr.Row():
|
| 169 |
with gr.Accordion(label="Process Config", open=False, visible=True):
|
| 170 |
process_config = get_process_config()
|
| 171 |
-
|
| 172 |
with gr.Row():
|
| 173 |
with gr.Accordion(label="Inference Config", open=False, visible=True):
|
| 174 |
inference_config = get_inference_config()
|
|
@@ -179,26 +180,30 @@ def build_demo():
|
|
| 179 |
with gr.Accordion(label="OpenVINO Config", open=False, visible=True):
|
| 180 |
openvino_config = get_openvino_config()
|
| 181 |
|
| 182 |
-
backends.change(
|
| 183 |
-
inputs=backends,
|
| 184 |
-
outputs=backend_configs.children,
|
| 185 |
-
fn=lambda values: [
|
| 186 |
-
gr.update(visible=value in values) for value in BACKENDS
|
| 187 |
-
],
|
| 188 |
-
)
|
| 189 |
-
|
| 190 |
with gr.Row():
|
| 191 |
button = gr.Button(value="Run Benchmark", variant="primary")
|
| 192 |
|
| 193 |
-
with gr.Row() as
|
| 194 |
with gr.Accordion(label="PyTorch Output", open=True, visible=True):
|
| 195 |
pytorch_output = gr.Markdown()
|
| 196 |
with gr.Accordion(label="OpenVINO Output", open=True, visible=True):
|
| 197 |
openvino_output = gr.Markdown()
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
backends.change(
|
| 200 |
inputs=backends,
|
| 201 |
-
outputs=
|
| 202 |
fn=lambda values: [
|
| 203 |
gr.update(visible=value in values) for value in BACKENDS
|
| 204 |
],
|
|
|
|
| 29 |
LAUNCHER = "process"
|
| 30 |
SCENARIO = "inference"
|
| 31 |
BACKENDS = ["pytorch", "openvino"]
|
| 32 |
+
MODELS = ["google-bert/bert-base-uncased", "openai-community/gpt2"]
|
| 33 |
+
MODELS_TO_TASKS = {
|
| 34 |
+
"google-bert/bert-base-uncased": "text-classification",
|
| 35 |
+
"openai-community/gpt2": "text-generation",
|
| 36 |
+
}
|
| 37 |
TASKS = set(TASKS_TO_OVMODEL.keys()) & set(TASKS_TO_MODEL_LOADERS.keys())
|
| 38 |
|
| 39 |
|
|
|
|
| 158 |
value="feature-extraction",
|
| 159 |
info="Task to run the benchmark on.",
|
| 160 |
)
|
| 161 |
+
|
| 162 |
backends = gr.CheckboxGroup(
|
| 163 |
interactive=True,
|
| 164 |
label="backends",
|
|
|
|
| 170 |
with gr.Row():
|
| 171 |
with gr.Accordion(label="Process Config", open=False, visible=True):
|
| 172 |
process_config = get_process_config()
|
|
|
|
| 173 |
with gr.Row():
|
| 174 |
with gr.Accordion(label="Inference Config", open=False, visible=True):
|
| 175 |
inference_config = get_inference_config()
|
|
|
|
| 180 |
with gr.Accordion(label="OpenVINO Config", open=False, visible=True):
|
| 181 |
openvino_config = get_openvino_config()
|
| 182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
with gr.Row():
|
| 184 |
button = gr.Button(value="Run Benchmark", variant="primary")
|
| 185 |
|
| 186 |
+
with gr.Row() as markdown_outputs:
|
| 187 |
with gr.Accordion(label="PyTorch Output", open=True, visible=True):
|
| 188 |
pytorch_output = gr.Markdown()
|
| 189 |
with gr.Accordion(label="OpenVINO Output", open=True, visible=True):
|
| 190 |
openvino_output = gr.Markdown()
|
| 191 |
|
| 192 |
+
model.change(
|
| 193 |
+
inputs=model, outputs=task, fn=lambda value: MODELS_TO_TASKS[value]
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
backends.change(
|
| 197 |
+
inputs=backends,
|
| 198 |
+
outputs=backend_configs.children,
|
| 199 |
+
fn=lambda values: [
|
| 200 |
+
gr.update(visible=value in values) for value in BACKENDS
|
| 201 |
+
],
|
| 202 |
+
)
|
| 203 |
+
|
| 204 |
backends.change(
|
| 205 |
inputs=backends,
|
| 206 |
+
outputs=markdown_outputs.children,
|
| 207 |
fn=lambda values: [
|
| 208 |
gr.update(visible=value in values) for value in BACKENDS
|
| 209 |
],
|