From e236f006593fb00633f9874fe414c87bd9735813 Mon Sep 17 00:00:00 2001 From: Michael Feil Date: Sat, 20 May 2023 02:18:07 +0200 Subject: [PATCH] correct position of decode args --- hf_hub_ctranslate2/translate.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hf_hub_ctranslate2/translate.py b/hf_hub_ctranslate2/translate.py index 7256aab..ffe5b84 100644 --- a/hf_hub_ctranslate2/translate.py +++ b/hf_hub_ctranslate2/translate.py @@ -117,7 +117,8 @@ def _forward(self, *args, **kwds): def tokenize_decode(self, tokens_out, *args, **kwargs): return [ self.tokenizer.decode( - self.tokenizer.convert_tokens_to_ids(tokens_out[i].hypotheses[0], *args, **kwargs) + self.tokenizer.convert_tokens_to_ids(tokens_out[i].hypotheses[0]), + *args, **kwargs ) for i in range(len(tokens_out)) ] @@ -210,7 +211,8 @@ def tokenize_encode(self, text, *args, **kwargs): def tokenize_decode(self, tokens_out, *args, **kwargs): return [ self.tokenizer.decode( - self.tokenizer.convert_tokens_to_ids(tokens_out[i].hypotheses[0][1:], *args, **kwargs) + self.tokenizer.convert_tokens_to_ids(tokens_out[i].hypotheses[0][1:]), + *args, **kwargs ) for i in range(len(tokens_out)) ]