diff --git a/lmdeploy/turbomind/turbomind.py b/lmdeploy/turbomind/turbomind.py index c39110b713..45760a309a 100644 --- a/lmdeploy/turbomind/turbomind.py +++ b/lmdeploy/turbomind/turbomind.py @@ -344,7 +344,7 @@ def _broadcast_np(data, dtype, shape=(batch_size, )): outputs = [] for output, len_ in zip(output_ids, sequence_length): output, len_ = output, len_.item() - if output[-1].item() == self.eos_id: + if len(output) > 0 and output[-1].item() == self.eos_id: outputs.append((output[:-1], len_ - 1)) else: outputs.append((output, len_))