Spaces:
Running
on
Zero
Running
on
Zero
Lord-Raven
commited on
Commit
·
bd9482b
1
Parent(s):
64dfd17
Trying to use ONNX model.
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from transformers import AutoTokenizer
|
|
5 |
from transformers import pipeline
|
6 |
from fastapi import FastAPI
|
7 |
from fastapi.middleware.cors import CORSMiddleware
|
8 |
-
from optimum.onnxruntime import
|
9 |
|
10 |
# CORS Config
|
11 |
app = FastAPI()
|
@@ -19,7 +19,7 @@ app.add_middleware(
|
|
19 |
)
|
20 |
|
21 |
model_name = "xenova/mobilebert-uncased-mnli"
|
22 |
-
model =
|
23 |
tokenizer = AutoTokenizer.from_pretrained("typeform/mobilebert-uncased-mnli", model_max_length=512)
|
24 |
|
25 |
# file = cached_download("https://huggingface.co/" + model_name + "")
|
|
|
5 |
from transformers import pipeline
|
6 |
from fastapi import FastAPI
|
7 |
from fastapi.middleware.cors import CORSMiddleware
|
8 |
+
from optimum.onnxruntime import ORTModelForSequenceClassification
|
9 |
|
10 |
# CORS Config
|
11 |
app = FastAPI()
|
|
|
19 |
)
|
20 |
|
21 |
model_name = "xenova/mobilebert-uncased-mnli"
|
22 |
+
model = ORTModelForSequenceClassification.from_pretrained(model_name, file_name="onnx/model.onnx")
|
23 |
tokenizer = AutoTokenizer.from_pretrained("typeform/mobilebert-uncased-mnli", model_max_length=512)
|
24 |
|
25 |
# file = cached_download("https://huggingface.co/" + model_name + "")
|