mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-11 20:34:54 +00:00
fixup.
This commit is contained in:
parent
1623a56544
commit
8dffe1ca08
@ -501,7 +501,7 @@ class GrammarLogitProcessor(LogitsProcessor):
|
|||||||
allowed_tokens = self.fsm.get_next_instruction(fsm_grammar_state).tokens
|
allowed_tokens = self.fsm.get_next_instruction(fsm_grammar_state).tokens
|
||||||
mask = torch.full_like(logits, -math.inf)
|
mask = torch.full_like(logits, -math.inf)
|
||||||
if allowed_tokens is not None:
|
if allowed_tokens is not None:
|
||||||
mask[:, allowed_tokens] = 0
|
mask[:, allowed_tokens] = 0
|
||||||
biased_scores = logits + mask
|
biased_scores = logits + mask
|
||||||
return biased_scores
|
return biased_scores
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user