ikeno-ada commited on
Commit
9fb9a13
·
verified ·
1 Parent(s): a8f8f7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
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