Skip to content

Commit

Permalink
fix output[-1] when output is empty (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangruohui authored Sep 13, 2023
1 parent 2537c5e commit 64c39dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lmdeploy/turbomind/turbomind.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_))
Expand Down

0 comments on commit 64c39dd

Please sign in to comment.