Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -120,7 +120,7 @@ lang_list = list(lang_ids.keys())
|
|
120 |
|
121 |
def translate(lang, text):
|
122 |
encoded = tokenizer(text, return_tensors="pt")
|
123 |
-
generated_tokens = model.generate(**encoded, forced_bos_token_id=tokenizer.get_lang_id(lang_ids[lang]))
|
124 |
return tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]
|
125 |
|
126 |
|
|
|
120 |
|
121 |
def translate(lang, text):
|
122 |
encoded = tokenizer(text, return_tensors="pt")
|
123 |
+
generated_tokens = model(use_cache=True).generate(**encoded, forced_bos_token_id=tokenizer.get_lang_id(lang_ids[lang]))
|
124 |
return tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]
|
125 |
|
126 |
|