Skip to content

Commit

Permalink
correct position of decode args
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfeil committed May 20, 2023
1 parent 3ed2b81 commit e236f00
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hf_hub_ctranslate2/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
]
Expand Down Expand Up @@ -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))
]
Expand Down

0 comments on commit e236f00

Please sign in to comment.