diff --git a/fastdeploy/engine/sched/resource_manager_v1.py b/fastdeploy/engine/sched/resource_manager_v1.py index b9af5b071..fdff2c0ba 100644 --- a/fastdeploy/engine/sched/resource_manager_v1.py +++ b/fastdeploy/engine/sched/resource_manager_v1.py @@ -173,23 +173,6 @@ class ResourceManagerV1(ResourceManager): prompt_token_ids_len = len(request.prompt_token_ids) - if new_end_idx >= prompt_token_ids_len: - return num_new_tokens - - if inputs.get("can_split_idx_list") is not None: - if new_end_idx >= prompt_token_ids_len: - return num_new_tokens - patch_idx = inputs["patch_idx"][new_end_idx] - patch_map = inputs["patch_map"][patch_idx] - modal_id = patch_map["modal_id"] - if modal_id == IDS_TYPE_FLAG["text"]: - return num_new_tokens - elif modal_id == IDS_TYPE_FLAG["video"]: - can_split_idx_list = inputs["can_split_idx_list"] - for i in range(len(can_split_idx_list)): - if can_split_idx_list[i] >= new_end_idx: - return can_split_idx_list[i] - pre_end_idx - assert prompt_token_ids_len == len(inputs["patch_idx"]), (prompt_token_ids_len, len(inputs["patch_idx"])) # start @@ -215,8 +198,17 @@ class ResourceManagerV1(ResourceManager): 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: + + if end_modal_id > 0 and end_modal_id != IDS_TYPE_FLAG["video"]: new_end_idx = end_patch_map["end_idx"] # 当前模态结束位置 + + if end_modal_id == IDS_TYPE_FLAG["video"]: + can_split_idx_list = inputs["can_split_idx_list"] + for i in range(len(can_split_idx_list)): + if can_split_idx_list[i] >= new_end_idx: + new_end_idx = can_split_idx_list[i] + break + num_new_tokens = new_end_idx - pre_end_idx request.image_end = end_patch_map["image_num"]