Update inference.py
Browse files- inference.py +3 -1
inference.py
CHANGED
@@ -28,7 +28,9 @@ def inference(input_text):
|
|
28 |
tokenizer = torch.load(saved_model_path + 'fine-tuned-tokenizer.pt', map_location=torch.device('cpu'))
|
29 |
model.eval()
|
30 |
input = tokenizer(input_text)
|
31 |
-
|
|
|
|
|
32 |
|
33 |
return output.tolist()
|
34 |
|
|
|
28 |
tokenizer = torch.load(saved_model_path + 'fine-tuned-tokenizer.pt', map_location=torch.device('cpu'))
|
29 |
model.eval()
|
30 |
input = tokenizer(input_text)
|
31 |
+
input_ids = torch.Tensor(input['input_ids']).squeeze(1)
|
32 |
+
mask = torch.Tensor(input['attention_mask'])
|
33 |
+
output = model(input_ids, mask)
|
34 |
|
35 |
return output.tolist()
|
36 |
|