Spaces:
Running
on
Zero
Running
on
Zero
Lord-Raven
commited on
Commit
·
9c16d91
1
Parent(s):
2d12eef
Trying ONNX models on CPU.
Browse files
app.py
CHANGED
@@ -27,14 +27,13 @@ print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
|
|
27 |
|
28 |
model_name = "MoritzLaurer/deberta-v3-base-zeroshot-v2.0"
|
29 |
tokenizer_name = "MoritzLaurer/deberta-v3-base-zeroshot-v2.0"
|
30 |
-
file_name = "onnx/model.onnx"
|
31 |
|
32 |
-
model_name_cpu = "MoritzLaurer/
|
33 |
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
classifier_cpu = pipeline(task="zero-shot-classification", model=
|
38 |
classifier_gpu = pipeline(task="zero-shot-classification", model=model_name, tokenizer=tokenizer_name, device="cuda:0")
|
39 |
|
40 |
def classify(data_string, request: gradio.Request):
|
|
|
27 |
|
28 |
model_name = "MoritzLaurer/deberta-v3-base-zeroshot-v2.0"
|
29 |
tokenizer_name = "MoritzLaurer/deberta-v3-base-zeroshot-v2.0"
|
|
|
30 |
|
31 |
+
model_name_cpu = "MoritzLaurer/roberta-large-zeroshot-v2.0-c"
|
32 |
|
33 |
+
model_cpu = ORTModelForSequenceClassification.from_pretrained(model_id=model_name_cpu, subfolder="onnx", file_name="model.onnx")
|
34 |
+
tokenizer_cpu = AutoTokenizer.from_pretrained(model_name_cpu)
|
35 |
|
36 |
+
classifier_cpu = pipeline(task="zero-shot-classification", model=model_name, tokenizer=tokenizer_cpu)
|
37 |
classifier_gpu = pipeline(task="zero-shot-classification", model=model_name, tokenizer=tokenizer_name, device="cuda:0")
|
38 |
|
39 |
def classify(data_string, request: gradio.Request):
|