From d9701a610434a998878d447c639b5f60b97eb525 Mon Sep 17 00:00:00 2001 From: Nathan Hoos Date: Tue, 7 May 2024 00:53:05 +0000 Subject: [PATCH] Working stable release! --- function_sampler/fsm/fsm_utils/src/lazy_index.rs | 2 ++ function_sampler/sampler.py | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/function_sampler/fsm/fsm_utils/src/lazy_index.rs b/function_sampler/fsm/fsm_utils/src/lazy_index.rs index ff0b3b7..7028572 100644 --- a/function_sampler/fsm/fsm_utils/src/lazy_index.rs +++ b/function_sampler/fsm/fsm_utils/src/lazy_index.rs @@ -104,6 +104,8 @@ impl LazyFSMIndex { #[pymethods] impl LazyFSMIndex { + + pub fn get_state_map(&self, state: u32) -> Option> { if let Some(token_map) = self.states_to_token_maps.get(&state) { return Some(token_map.clone()); diff --git a/function_sampler/sampler.py b/function_sampler/sampler.py index ff03973..eee960a 100644 --- a/function_sampler/sampler.py +++ b/function_sampler/sampler.py @@ -333,8 +333,6 @@ def __call__( self.fsm_state = self.fsm.next_state( self.fsm_state, int(last_token) ) - if self.fsm_state == -1: - raise Exception("Final state achieved") allowed_tokens = self.fsm.allowed_token_ids(self.fsm_state) if allowed_tokens == [-2]: