[Fix] Fix the padded hash value for image tokens (#2309)

This commit is contained in:
Lianmin Zheng
2024-12-01 23:36:28 -08:00
committed by GitHub
parent 983bfcf386
commit 3c79ad35ca

View File

@@ -1170,6 +1170,14 @@ class Scheduler:
+ 1 : len(req.fill_ids)
- req.last_update_decode_tokens
]
# Clip the padded hash values from image tokens.
# Otherwise, it will lead to detokenization errors.
input_token_ids = [
x if x < self.model_config.vocab_size - 1 else 0
for x in input_token_ids
]
req.input_token_logprobs = list(zip(input_token_logprobs, input_token_ids))
if (