Update handler.py to handle lists
Browse files- handler.py +1 -1
handler.py
CHANGED
|
@@ -41,7 +41,7 @@ class EndpointHandler:
|
|
| 41 |
batch_texts = texts[i:i+batch_size]
|
| 42 |
|
| 43 |
# Tokenize the input text
|
| 44 |
-
inputs = self.tokenizer(
|
| 45 |
if 'token_type_ids' in inputs:
|
| 46 |
del inputs['token_type_ids']
|
| 47 |
inputs = {key: val.to(self.device) for key, val in inputs.items()}
|
|
|
|
| 41 |
batch_texts = texts[i:i+batch_size]
|
| 42 |
|
| 43 |
# Tokenize the input text
|
| 44 |
+
inputs = self.tokenizer(batch_texts, return_tensors='pt', max_length=256, truncation=True, padding=True)
|
| 45 |
if 'token_type_ids' in inputs:
|
| 46 |
del inputs['token_type_ids']
|
| 47 |
inputs = {key: val.to(self.device) for key, val in inputs.items()}
|