From d67cbbf709bed4bf2d5c2a7461fdaf015b74c46b Mon Sep 17 00:00:00 2001 From: jhj0517 <97279763+jhj0517@users.noreply.github.com> Date: Sat, 9 Nov 2024 11:17:19 +0900 Subject: [PATCH] Cast to int if it's float --- src/transformers/tokenization_utils_fast.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/transformers/tokenization_utils_fast.py b/src/transformers/tokenization_utils_fast.py index 5d238a5715ffd2..1243c3944ebd6c 100644 --- a/src/transformers/tokenization_utils_fast.py +++ b/src/transformers/tokenization_utils_fast.py @@ -648,6 +648,8 @@ def _decode( if isinstance(token_ids, int): token_ids = [token_ids] + if token_ids and isinstance(token_ids[0], float): + token_ids = [int(_id) for _id in token_ids] text = self._tokenizer.decode(token_ids, skip_special_tokens=skip_special_tokens) clean_up_tokenization_spaces = (