Update handler.py
Browse files- handler.py +5 -1
handler.py
CHANGED
@@ -7,7 +7,11 @@ from optimum.pipelines import pipeline
|
|
7 |
class EndpointHandler():
|
8 |
def __init__(self, path=""):
|
9 |
# load the optimized model
|
10 |
-
model = ORTModelForSequenceClassification.from_pretrained(
|
|
|
|
|
|
|
|
|
11 |
tokenizer = AutoTokenizer.from_pretrained(path)
|
12 |
# create inference pipeline
|
13 |
self.pipeline = pipeline("text-classification", model=model, tokenizer=tokenizer, device=0)
|
|
|
7 |
class EndpointHandler():
|
8 |
def __init__(self, path=""):
|
9 |
# load the optimized model
|
10 |
+
model = ORTModelForSequenceClassification.from_pretrained(
|
11 |
+
path,
|
12 |
+
export=False,
|
13 |
+
provider="CUDAExecutionProvider",
|
14 |
+
)
|
15 |
tokenizer = AutoTokenizer.from_pretrained(path)
|
16 |
# create inference pipeline
|
17 |
self.pipeline = pipeline("text-classification", model=model, tokenizer=tokenizer, device=0)
|