Commit 872b4a6a authored by Raul Puri's avatar Raul Puri
Browse files

Fixed edge case with multiple end of sequence in one sequence

parent cf2f4d9d
......@@ -417,7 +417,7 @@ def sample_sequence_batch(model, context_tokens, context_lengths, attention_mask
context_length += 1
counter += 1
done_token = (prev == eos_id).byte()
done_token = (prev == eos_id).byte() & started.byte()
just_finished = (done_token & ~is_done).bool()
lengths[just_finished.view(-1)] = context_length
was_done = is_done
......
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