Update handler.py
Browse files- handler.py +1 -1
handler.py
CHANGED
@@ -21,7 +21,7 @@ class EndpointHandler():
|
|
21 |
|
22 |
# tokenize the input
|
23 |
encoded = tokenizer(text, return_tensors="pt")
|
24 |
-
encoded = encoded.to(
|
25 |
# run the model
|
26 |
generated_tokens = model.generate(**encoded, forced_bos_token_id=tokenizer.get_lang_id(langId))
|
27 |
result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]
|
|
|
21 |
|
22 |
# tokenize the input
|
23 |
encoded = tokenizer(text, return_tensors="pt")
|
24 |
+
encoded = encoded.to(model.device)
|
25 |
# run the model
|
26 |
generated_tokens = model.generate(**encoded, forced_bos_token_id=tokenizer.get_lang_id(langId))
|
27 |
result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]
|