Skip to content

Commit

Permalink
Filter out input ids not being used in inference. Fixes issue dottxt-…
Browse files Browse the repository at this point in the history
  • Loading branch information
priyank9320 committed Dec 2, 2024
1 parent 36f1bf2 commit ac54946
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions outlines/processors/structured.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def process_logits(
allowed_tokens = self.guide.get_next_instruction(guide_state).tokens.to(
mask.device, non_blocking=True
)
allowed_tokens = allowed_tokens[allowed_tokens < mask.shape[-1]] # filter out input ids exceeding the mask length
allowed_tokens_batch.append(allowed_tokens)
batch_indices.append(
torch.full_like(allowed_tokens, i)
Expand Down

0 comments on commit ac54946

Please sign in to comment.