Unverified Commit 64c39dd8 authored by WRH's avatar WRH Committed by GitHub
Browse files

fix output[-1] when output is empty (#405)

parent 2537c5ed
......@@ -344,7 +344,7 @@ class TurboMindInstance:
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_))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment