Skip to content

Commit 306c024

Browse files
authored
[BugFix] fix error of import paddle.base.core.Config (#3761)
* 延迟 import Config * support chunked_prefill * support chunked_prefill
1 parent 905d89e commit 306c024

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

fastdeploy/engine/sched/resource_manager_v1.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,31 @@ def _get_num_new_tokens(self, request, token_budget):
145145
if inputs.get("patch_idx", None) is not None and inputs.get("patch_map", None) is not None:
146146
pre_end_idx = request.num_computed_tokens
147147
new_end_idx = pre_end_idx + num_new_tokens
148+
149+
prompt_token_ids_len = len(request.prompt_token_ids)
150+
assert prompt_token_ids_len == len(inputs["patch_idx"]), (prompt_token_ids_len, len(inputs["patch_idx"]))
151+
148152
# start
149-
start_patch_idx = inputs["patch_idx"][pre_end_idx]
153+
if pre_end_idx >= prompt_token_ids_len:
154+
start_patch_idx = inputs["patch_idx"][-1]
155+
else:
156+
start_patch_idx = inputs["patch_idx"][pre_end_idx]
150157
start_patch_map = inputs["patch_map"][start_patch_idx]
151158
request.image_start = start_patch_map["image_num"]
152159
request.video_start = start_patch_map["video_num"]
153160
request.audio_start = start_patch_map["audio_num"]
154161

155162
# end
156-
end_patch_idx = inputs["patch_idx"][new_end_idx]
163+
if new_end_idx >= prompt_token_ids_len:
164+
end_patch_idx = inputs["patch_idx"][-1]
165+
else:
166+
end_patch_idx = inputs["patch_idx"][new_end_idx]
167+
if request.prompt_token_ids[new_end_idx] in [
168+
inputs["image_end_id"],
169+
inputs["video_end_id"],
170+
inputs["audio_end_id"],
171+
]:
172+
end_patch_idx -= 1
157173
end_patch_map = inputs["patch_map"][end_patch_idx]
158174
end_modal_id = end_patch_map["modal_id"]
159175
if end_modal_id > 0:

fastdeploy/model_executor/layers/moe/ep.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import paddle
2020
from paddle import nn
21-
from paddle.base.core import Config
2221
from paddleformers.utils.log import logger
2322

2423
try:
@@ -103,6 +102,8 @@ def __init__(
103102

104103
self.deepep_engine = None
105104

105+
from paddle.base.core import Config
106+
106107
self.ep_config = Config(24, 6, 256)
107108
self.num_max_dispatch_tokens_per_rank = num_max_dispatch_tokens_per_rank
108109

0 commit comments

Comments
 (0)