Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lvhan028 committed Nov 14, 2023
1 parent 8d11249 commit e783f2c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lmdeploy/turbomind/turbomind.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,15 @@ def _broadcast_np(data, dtype, shape=(batch_size, )):
outputs = _tm_dict_to_torch_dict(tm_outputs)

output_ids = outputs['output_ids'][:, 0, :]
sequence_length = outputs['sequence_length'].long()[:, 0].cpu()
# sequence_length = outputs['sequence_length'].long()[:, 0]
# sequence_length = outputs['sequence_length'].long()[:, 0].cpu()
sequence_length = outputs['sequence_length'].long()[:, 0]
output_ids = [
output_id[s:l] for output_id, s, l in zip(
output_ids, seq_start, sequence_length)
]
sequence_length -= seq_start.to(sequence_length.device)

# outputs = [(1, 1)]
outputs = []
for output, len_ in zip(output_ids, sequence_length):
output, len_ = output, len_.item()
if len(output) > 0 and output[-1].item() == self.eos_id:
Expand All @@ -363,7 +363,6 @@ def _broadcast_np(data, dtype, shape=(batch_size, )):
outputs.append((output[:-1], len_))
else:
outputs.append((output, len_))

yield outputs

if finish:
Expand Down

0 comments on commit e783f2c

Please sign in to comment.