Commit
•
cb9bb26
1
Parent(s):
8e1ebc1
Update handler.py
Browse files- handler.py +2 -2
handler.py
CHANGED
@@ -20,12 +20,12 @@ class EndpointHandler():
|
|
20 |
|
21 |
token_boxes = []
|
22 |
for word, box in zip(words, normalized_word_boxes):
|
23 |
-
word_tokens = tokenizer.tokenize(word)
|
24 |
token_boxes.extend([box] * len(word_tokens))
|
25 |
# add bounding boxes of cls + sep tokens
|
26 |
token_boxes = [[0, 0, 0, 0]] + token_boxes + [[1000, 1000, 1000, 1000]]
|
27 |
|
28 |
-
encoding = tokenizer(" ".join(words), return_tensors="pt")
|
29 |
input_ids = encoding["input_ids"]
|
30 |
attention_mask = encoding["attention_mask"]
|
31 |
token_type_ids = encoding["token_type_ids"]
|
|
|
20 |
|
21 |
token_boxes = []
|
22 |
for word, box in zip(words, normalized_word_boxes):
|
23 |
+
word_tokens = self.tokenizer.tokenize(word)
|
24 |
token_boxes.extend([box] * len(word_tokens))
|
25 |
# add bounding boxes of cls + sep tokens
|
26 |
token_boxes = [[0, 0, 0, 0]] + token_boxes + [[1000, 1000, 1000, 1000]]
|
27 |
|
28 |
+
encoding = self.tokenizer(" ".join(words), return_tensors="pt")
|
29 |
input_ids = encoding["input_ids"]
|
30 |
attention_mask = encoding["attention_mask"]
|
31 |
token_type_ids = encoding["token_type_ids"]
|