File tree 3 files changed +14
-1
lines changed
3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 30
30
- id : mypy
31
31
args : [--allow-redefinition]
32
32
exclude : ^examples/
33
+ additional_dependencies : [types-tqdm]
Original file line number Diff line number Diff line change 26
26
anything_else ,
27
27
)
28
28
from numba .typed .typedobjectutils import _nonoptional
29
+ from tqdm import tqdm
29
30
30
31
if TYPE_CHECKING :
31
32
from outlines .models .tokenizer import Tokenizer
@@ -692,6 +693,12 @@ def create_fsm_index_end_to_end(
692
693
seen : Set [int ] = set ()
693
694
next_states = {fsm_info .initial }
694
695
696
+ pbar = tqdm (
697
+ total = len (set (fsm_info .transitions .values ()))
698
+ + 1 , # all transitions plus initial
699
+ desc = "Compiling FSM index for all state transitions" ,
700
+ )
701
+
695
702
while next_states :
696
703
start_state = next_states .pop ()
697
704
@@ -713,7 +720,11 @@ def create_fsm_index_end_to_end(
713
720
if end_state not in seen :
714
721
next_states .add (end_state )
715
722
716
- seen .add (start_state )
723
+ if start_state not in seen :
724
+ pbar .update (1 )
725
+ seen .add (start_state )
726
+
727
+ pbar .close ()
717
728
718
729
return states_to_token_subsets
719
730
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ dependencies = [
35
35
" referencing" ,
36
36
" jsonschema" ,
37
37
" requests" ,
38
+ " tqdm"
38
39
]
39
40
dynamic = [" version" ]
40
41
You can’t perform that action at this time.
0 commit comments