raheemuddin commited on
Commit
21052af
·
1 Parent(s): 5d2d3ae

test with another model

Browse files
Files changed (1) hide show
  1. handler.py +12 -3
handler.py CHANGED
@@ -1,13 +1,22 @@
1
  from typing import Dict, List, Any
2
- from optimum.onnxruntime import ORTModelForSequenceClassification
 
 
3
  from transformers import pipeline, AutoTokenizer
4
 
 
5
 
6
  class EndpointHandler():
 
7
  def __init__(self, path=""):
8
  # load the optimized model
9
- model = ORTModelForSequenceClassification.from_pretrained(path)
10
- tokenizer = AutoTokenizer.from_pretrained(path)
 
 
 
 
 
11
  # create inference pipeline
12
  self.pipeline = pipeline("text-classification", model=model, tokenizer=tokenizer)
13
 
 
1
  from typing import Dict, List, Any
2
+ # from optimum.onnxruntime import ORTModelForSequenceClassification
3
+ from transformers import AutoModel
4
+
5
  from transformers import pipeline, AutoTokenizer
6
 
7
+ checkpoint = "distilbert-base-uncased-finetuned-sst-2-english"
8
 
9
  class EndpointHandler():
10
+
11
  def __init__(self, path=""):
12
  # load the optimized model
13
+ # model = ORTModelForSequenceClassification.from_pretrained(path)
14
+ model = AutoModel.from_pretrained(checkpoint)
15
+ # model = AutoModelForSequenceClassification.from_pretrained(checkpoint)
16
+
17
+ # tokenizer = AutoTokenizer.from_pretrained(path)
18
+ tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path=checkpoint)
19
+
20
  # create inference pipeline
21
  self.pipeline = pipeline("text-classification", model=model, tokenizer=tokenizer)
22