[BugFix] fix error of import paddle.base.core.Config (#3761) (#3804)

* 延迟 import Config

* support chunked_prefill

* support chunked_prefill
This commit is contained in:
Yuanle Liu
2025-09-03 10:14:03 +08:00
committed by GitHub
parent 5cda326ba2
commit 174510180a
2 changed files with 20 additions and 3 deletions

View File

@@ -145,7 +145,14 @@ class ResourceManagerV1(ResourceManager):
if inputs.get("patch_idx", None) is not None and inputs.get("patch_map", None) is not None:
pre_end_idx = request.num_computed_tokens
new_end_idx = pre_end_idx + num_new_tokens
prompt_token_ids_len = len(request.prompt_token_ids)
assert prompt_token_ids_len == len(inputs["patch_idx"]), (prompt_token_ids_len, len(inputs["patch_idx"]))
# start
if pre_end_idx >= prompt_token_ids_len:
start_patch_idx = inputs["patch_idx"][-1]
else:
start_patch_idx = inputs["patch_idx"][pre_end_idx]
start_patch_map = inputs["patch_map"][start_patch_idx]
request.image_start = start_patch_map["image_num"]
@@ -153,7 +160,16 @@ class ResourceManagerV1(ResourceManager):
request.audio_start = start_patch_map["audio_num"]
# end
if new_end_idx >= prompt_token_ids_len:
end_patch_idx = inputs["patch_idx"][-1]
else:
end_patch_idx = inputs["patch_idx"][new_end_idx]
if request.prompt_token_ids[new_end_idx] in [
inputs["image_end_id"],
inputs["video_end_id"],
inputs["audio_end_id"],
]:
end_patch_idx -= 1
end_patch_map = inputs["patch_map"][end_patch_idx]
end_modal_id = end_patch_map["modal_id"]
if end_modal_id > 0:

View File

@@ -18,7 +18,6 @@ from abc import abstractmethod
import paddle
from paddle import nn
from paddle.base.core import Config
from paddleformers.utils.log import logger
try:
@@ -103,6 +102,8 @@ class DeepEPEngine:
self.deepep_engine = None
from paddle.base.core import Config
self.ep_config = Config(24, 6, 256)
self.num_max_dispatch_tokens_per_rank = num_max_dispatch_tokens_per_rank