File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -578,8 +578,10 @@ def schedule(self) -> SchedulerOutput:
578578 scheduled_spec_decode_tokens ,
579579 req_to_new_blocks ,
580580 )
581+ scheduled_requests = (scheduled_new_reqs + scheduled_running_reqs +
582+ scheduled_resumed_reqs )
581583 structured_output_request_ids , grammar_bitmask = (
582- self .get_grammar_bitmask (self . running ,
584+ self .get_grammar_bitmask (scheduled_requests ,
583585 scheduled_spec_decode_tokens ))
584586 scheduler_output = SchedulerOutput (
585587 scheduled_new_reqs = new_reqs_data ,
Original file line number Diff line number Diff line change @@ -90,13 +90,14 @@ def apply_grammar_bitmask(
9090 seq = sorted (scheduler_output .structured_output_request_ids .items (),
9191 key = lambda x : x [1 ])
9292 for req_id , _ in seq :
93- logit_index = struct_out_req_batch_indices [req_id ]
9493 num_spec_tokens = len (
9594 scheduler_output .scheduled_spec_decode_tokens .get (req_id , []))
96- for i in range (1 + num_spec_tokens ):
97- sorted_bitmask [logit_index + i ] = \
98- grammar_bitmask [cumulative_index + i ]
99- out_indices .append (logit_index + i )
95+ if req_id in struct_out_req_batch_indices :
96+ logit_index = struct_out_req_batch_indices [req_id ]
97+ for i in range (1 + num_spec_tokens ):
98+ sorted_bitmask [logit_index + i ] = \
99+ grammar_bitmask [cumulative_index + i ]
100+ out_indices .append (logit_index + i )
100101 cumulative_index += 1 + num_spec_tokens
101102 grammar_bitmask = sorted_bitmask
102103
You can’t perform that action at this time.
0 commit comments