[BugFix]: Fix async scheduer transfer exceed KV cache (#3318)
Signed-off-by: princepride <wangzhipeng628@gmail.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
4c06bb09ed
commit
e50a066548
2 files changed
+42
-6
No files matched your search
@@ -567,7 +567,12 @@ class OmniBagelForConditionalGeneration(BagelForConditionalGeneration):
|
||||
return None
|
||||
if num_computed_tokens is not None and "image_shape" in meta:
|
||||
prefill_rope = meta["ropes"][0] if meta.get("ropes") else 0
|
||||
if num_computed_tokens > prefill_rope:
|
||||
prefill_position_count = meta.get("prefill_position_count")
|
||||
if prefill_position_count is not None:
|
||||
num_decoded = num_computed_tokens - prefill_position_count
|
||||
if num_decoded > 0:
|
||||
meta["ropes"] = [prefill_rope + num_decoded]
|
||||
elif num_computed_tokens > prefill_rope:
|
||||
meta["ropes"] = [num_computed_tokens]
|
||||
return meta
|
||||
|
||||
@@ -849,6 +854,7 @@ class OmniBagelForConditionalGeneration(BagelForConditionalGeneration):
|
||||
{
|
||||
"ropes": [rope],
|
||||
"image_shape": [img_H, img_W],
|
||||
"prefill_position_count": int(end - start),
|
||||
}
|
||||
)
|
||||
img2img_idx += 1
|
||||
|
||||
Reference in new issue
Block a user