Skip to content

Commit

Permalink
[BugFix][Core] Fix BlockManagerV2 when Encoder Input is None (vllm-pr…
Browse files Browse the repository at this point in the history
…oject#9103)

Signed-off-by: Alvant <[email protected]>
  • Loading branch information
sroy745 authored and Alvant committed Oct 26, 2024
1 parent 2eaac16 commit 38e22b1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 0 additions & 2 deletions vllm/core/block/block_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ def free(self) -> None:
occupied by each block. After freeing all the blocks, the `_blocks` list
is set to `None`.
"""
assert self._is_allocated
for block in self.blocks:
self._allocator.free(block)
self._blocks.reset()
Expand All @@ -239,7 +238,6 @@ def physical_block_ids(self) -> List[int]:
List[int]: A list of physical block indices for the blocks in the
BlockTable.
"""
assert self._is_allocated
return self._blocks.ids()

def get_unseen_token_ids(self, sequence_token_ids: List[int]) -> List[int]:
Expand Down
4 changes: 3 additions & 1 deletion vllm/core/block_manager_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ def _allocate_sequence(self, seq: Sequence) -> BlockTable:
block_allocator=self.block_allocator,
max_block_sliding_window=self.max_block_sliding_window,
)
block_table.allocate(seq.get_token_ids())
if seq.get_token_ids():
# Add blocks to the block table only if the sequence is non empty.
block_table.allocate(seq.get_token_ids())

return block_table

Expand Down
5 changes: 0 additions & 5 deletions vllm/engine/arg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,11 +903,6 @@ def create_engine_config(self) -> EngineConfig:
"--enable-prefix-caching is currently not "
"supported for multimodal models and has been disabled.")
self.enable_prefix_caching = False
if model_config.is_encoder_decoder_model:
logger.warning(
"Block Manager v2 does not support encoder-decoder models"
" currently. Using Block Manager v1 as fallback.")
self.use_v2_block_manager = False

cache_config = CacheConfig(
block_size=self.block_size if self.device != "neuron" else
Expand Down

0 comments on commit 38e22b1

Please sign in to comment.