diff --git a/tests/fsm/test_statistical.py b/tests/fsm/test_statistical.py index 17d8a026..20ef28cd 100644 --- a/tests/fsm/test_statistical.py +++ b/tests/fsm/test_statistical.py @@ -49,7 +49,7 @@ def generate(model, tokenizer, regex_str) -> Optional[List[int]]: fsm = RegexGuide.from_regex(regex_str, tokenizer) state: int = fsm.initial_state tokens = None - while state is not None: + while state != -1: allowed = fsm.get_next_instruction(state).tokens mask: List[int] = [1 if s in allowed else 0 for s in range(1, n_tokens + 1)] tokens = model(tokens, mask=mask)