Spaces:
Runtime error
Runtime error
Commit
·
4dc3331
1
Parent(s):
308b0dd
Fix typo in pruned text
Browse files
app.py
CHANGED
|
@@ -8,8 +8,8 @@ from transformers import AutoModelForQuestionAnswering, AutoTokenizer
|
|
| 8 |
|
| 9 |
models = {
|
| 10 |
"Base model": "bert-large-uncased-whole-word-masking-finetuned-squad",
|
| 11 |
-
"
|
| 12 |
-
"
|
| 13 |
}
|
| 14 |
|
| 15 |
|
|
@@ -31,7 +31,7 @@ def run_normal_hf(model_name, inputs):
|
|
| 31 |
|
| 32 |
def inference(model_name, context, question):
|
| 33 |
tokenizer = AutoTokenizer.from_pretrained(models[model_name])
|
| 34 |
-
if model_name == "
|
| 35 |
inputs = dict(tokenizer(question, context, return_tensors="np"))
|
| 36 |
output, inference_time = run_ort_inference(model_name, inputs)
|
| 37 |
answer_start_scores, answer_end_scores = torch.tensor(output[0]), torch.tensor(
|
|
@@ -53,8 +53,8 @@ def inference(model_name, context, question):
|
|
| 53 |
|
| 54 |
|
| 55 |
model_field = gr.Dropdown(
|
| 56 |
-
choices=["Base model", "
|
| 57 |
-
value="
|
| 58 |
label="Model",
|
| 59 |
)
|
| 60 |
input_text_field = gr.Textbox(placeholder="Enter the text here", label="Text")
|
|
|
|
| 8 |
|
| 9 |
models = {
|
| 10 |
"Base model": "bert-large-uncased-whole-word-masking-finetuned-squad",
|
| 11 |
+
"Pruned model": "madlag/bert-large-uncased-wwm-squadv2-x2.63-f82.6-d16-hybrid-v1",
|
| 12 |
+
"Pruned ONNX Optimized FP16": "tryolabs/bert-large-uncased-wwm-squadv2-optimized-f16",
|
| 13 |
}
|
| 14 |
|
| 15 |
|
|
|
|
| 31 |
|
| 32 |
def inference(model_name, context, question):
|
| 33 |
tokenizer = AutoTokenizer.from_pretrained(models[model_name])
|
| 34 |
+
if model_name == "Pruned ONNX Optimized FP16":
|
| 35 |
inputs = dict(tokenizer(question, context, return_tensors="np"))
|
| 36 |
output, inference_time = run_ort_inference(model_name, inputs)
|
| 37 |
answer_start_scores, answer_end_scores = torch.tensor(output[0]), torch.tensor(
|
|
|
|
| 53 |
|
| 54 |
|
| 55 |
model_field = gr.Dropdown(
|
| 56 |
+
choices=["Base model", "Pruned model", "Pruned ONNX Optimized FP16"],
|
| 57 |
+
value="Pruned ONNX Optimized FP16",
|
| 58 |
label="Model",
|
| 59 |
)
|
| 60 |
input_text_field = gr.Textbox(placeholder="Enter the text here", label="Text")
|