Spaces:
Sleeping
Sleeping
Chidam Gopal
commited on
update
Browse files- infer_intent.py +1 -2
infer_intent.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
from transformers import AutoTokenizer
|
| 2 |
-
import torch
|
| 3 |
import onnxruntime as ort
|
| 4 |
import numpy as np
|
| 5 |
import requests
|
|
@@ -36,7 +35,7 @@ class IntentClassifier:
|
|
| 36 |
|
| 37 |
def find_intent(self, sequence, verbose=False):
|
| 38 |
inputs = self.tokenizer(sequence,
|
| 39 |
-
return_tensors="
|
| 40 |
padding="max_length", # Pad to max length
|
| 41 |
truncation=True, # Truncate if the text is too long
|
| 42 |
max_length=64)
|
|
|
|
| 1 |
from transformers import AutoTokenizer
|
|
|
|
| 2 |
import onnxruntime as ort
|
| 3 |
import numpy as np
|
| 4 |
import requests
|
|
|
|
| 35 |
|
| 36 |
def find_intent(self, sequence, verbose=False):
|
| 37 |
inputs = self.tokenizer(sequence,
|
| 38 |
+
return_tensors="np", # ONNX requires inputs in NumPy format
|
| 39 |
padding="max_length", # Pad to max length
|
| 40 |
truncation=True, # Truncate if the text is too long
|
| 41 |
max_length=64)
|