Skip to content

Commit c8f26bb

Browse files
authored
[BugFix][Core] Fix BlockManagerV2 when Encoder Input is None (#9103)
1 parent 487678d commit c8f26bb

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

vllm/core/block/block_table.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ def free(self) -> None:
220220
occupied by each block. After freeing all the blocks, the `_blocks` list
221221
is set to `None`.
222222
"""
223-
assert self._is_allocated
224223
for block in self.blocks:
225224
self._allocator.free(block)
226225
self._blocks.reset()
@@ -239,7 +238,6 @@ def physical_block_ids(self) -> List[int]:
239238
List[int]: A list of physical block indices for the blocks in the
240239
BlockTable.
241240
"""
242-
assert self._is_allocated
243241
return self._blocks.ids()
244242

245243
def get_unseen_token_ids(self, sequence_token_ids: List[int]) -> List[int]:

vllm/core/block_manager_v2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ def _allocate_sequence(self, seq: Sequence) -> BlockTable:
151151
block_allocator=self.block_allocator,
152152
max_block_sliding_window=self.max_block_sliding_window,
153153
)
154-
block_table.allocate(seq.get_token_ids())
154+
if seq.get_token_ids():
155+
# Add blocks to the block table only if the sequence is non empty.
156+
block_table.allocate(seq.get_token_ids())
155157

156158
return block_table
157159

vllm/engine/arg_utils.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -903,11 +903,6 @@ def create_engine_config(self) -> EngineConfig:
903903
"--enable-prefix-caching is currently not "
904904
"supported for multimodal models and has been disabled.")
905905
self.enable_prefix_caching = False
906-
if model_config.is_encoder_decoder_model:
907-
logger.warning(
908-
"Block Manager v2 does not support encoder-decoder models"
909-
" currently. Using Block Manager v1 as fallback.")
910-
self.use_v2_block_manager = False
911906

912907
cache_config = CacheConfig(
913908
block_size=self.block_size if self.device != "neuron" else

0 commit comments

Comments
 (0)