Skip to content

Commit

Permalink
Translate now returns a single string instead of a list
Browse files Browse the repository at this point in the history
  • Loading branch information
x-tabdeveloping committed Jan 23, 2024
1 parent c75629a commit e1cefd9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/seb/registered_models/translate_e5_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def translate(self, sentence: str, src_lang: str) -> str:
gen_tokens = self.trans_model.generate(
**encoded_sent, forced_bos_token_id=self.trans_tokenizer.get_lang_id("en")
)
return self.trans_tokenizer.batch_decode(gen_tokens, skip_special_tokens=True)
return self.trans_tokenizer.batch_decode(gen_tokens, skip_special_tokens=True)[
0
]

def encode(
self,
Expand Down

0 comments on commit e1cefd9

Please sign in to comment.