File tree 1 file changed +2
-7
lines changed
vllm/v1/structured_output
1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -119,9 +119,6 @@ def grammar_bitmask(
119
119
# position in the batch. Resize the bitmask down to the size of
120
120
# the batch.
121
121
bitmask_tensor = self ._grammar_bitmask
122
- # Reset the relevant part of the bitmask before filling
123
- if batch_len > 0 :
124
- bitmask_tensor [:batch_len ].fill_ (- 1 )
125
122
126
123
for req_id , batch_index in structured_output_request_ids .items ():
127
124
full_request = requests [req_id ]
@@ -137,11 +134,9 @@ def grammar_bitmask(
137
134
so_request .grammar .fill_bitmask (bitmask_tensor , batch_index )
138
135
139
136
if batch_len < bitmask_tensor .shape [0 ]:
140
- final_bitmask_tensor = bitmask_tensor [:batch_len ]
141
- else :
142
- final_bitmask_tensor = bitmask_tensor
137
+ bitmask_tensor = self ._grammar_bitmask [:batch_len ]
143
138
144
139
# After finishing with the xgrammar operations, we convert to
145
140
# np.ndarray, because that is much more efficient for serialization
146
141
# and deserialization when sending this to the GPU workers.
147
- return final_bitmask_tensor .numpy ()
142
+ return bitmask_tensor .numpy ()
You can’t perform that action at this time.
0 commit comments