Commit 7f022e4d authored by zhuwenwen's avatar zhuwenwen
Browse files

Merge branch 'lizhg1-v0.8.5.post1-dev-patch-30255' into 'v0.8.5.post1-dev'

Update sequence.py fix assert error。

See merge request dcutoolkit/deeplearing/vllm!121
parents 7bdb03ea d82fa156
from typing import Union
from vllm.sequence import Sequence
from typing import Sequence as GenericSequence
......@@ -12,12 +11,12 @@ class ZeroOverheadSequence(Sequence):
def fix_last_token_id(self, token_id: int) -> None:
effect_offset = self.effective_output_len - len(self.data.output_token_ids)
assert effect_offset < 0
self.data._output_token_ids[effect_offset] = token_id
if len(self.data._new_appended_tokens) >= effect_offset * -1:
self.data._new_appended_tokens[effect_offset] = token_id
self.data._cached_all_token_ids[effect_offset] = token_id
self.effective_output_len += 1
if effect_offset < 0:
self.data._output_token_ids[effect_offset] = token_id
if len(self.data._new_appended_tokens) >= effect_offset * -1:
self.data._new_appended_tokens[effect_offset] = token_id
self.data._cached_all_token_ids[effect_offset] = token_id
self.effective_output_len += 1
def remove_last_place_holder(self, count):
self.data._output_token_ids = self.data._output_token_ids[:-1 * count]
......@@ -62,4 +61,4 @@ class ZeroOverheadSequence(Sequence):
return []
effect_offset = self.effective_output_len - len(self.data.output_token_ids)
return self.data._cached_all_token_ids[-num_new_tokens : effect_offset]
\ No newline at end of file
return self.data._cached_all_token_ids[-num_new_tokens : effect_offset]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment