mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-11 11:30:20 +08:00
[Bug Fix] Fix V1 video bug (#3387)
This commit is contained in:
@@ -142,6 +142,10 @@ class ResourceManagerV1(ResourceManager):
|
|||||||
|
|
||||||
input_ids_lst = request.prompt_token_ids + request.output_token_ids
|
input_ids_lst = request.prompt_token_ids + request.output_token_ids
|
||||||
input_ids = paddle.to_tensor(input_ids_lst, dtype="int64")
|
input_ids = paddle.to_tensor(input_ids_lst, dtype="int64")
|
||||||
|
input_ids = paddle.to_tensor(input_ids_lst, dtype="int64")
|
||||||
|
image_patch_id = inputs["image_patch_id"]
|
||||||
|
|
||||||
|
if request.multimodal_img_boundaries is None:
|
||||||
grid_thw = []
|
grid_thw = []
|
||||||
for one in inputs["grid_thw"]:
|
for one in inputs["grid_thw"]:
|
||||||
if one[0] == 1:
|
if one[0] == 1:
|
||||||
@@ -149,19 +153,20 @@ class ResourceManagerV1(ResourceManager):
|
|||||||
else:
|
else:
|
||||||
grid_thw.extend([[2, one[1], one[2]]] * (one[0] // 2))
|
grid_thw.extend([[2, one[1], one[2]]] * (one[0] // 2))
|
||||||
|
|
||||||
image_patch_id = inputs["image_patch_id"]
|
|
||||||
grid_thw = paddle.to_tensor(grid_thw, dtype="int64")
|
grid_thw = paddle.to_tensor(grid_thw, dtype="int64")
|
||||||
if request.multimodal_img_boundaries is None:
|
|
||||||
from fastdeploy.model_executor.ops.gpu import get_img_boundaries
|
from fastdeploy.model_executor.ops.gpu import get_img_boundaries
|
||||||
|
|
||||||
request.multimodal_img_boundaries = get_img_boundaries(
|
request.multimodal_img_boundaries = get_img_boundaries(
|
||||||
task_input_ids=input_ids, grid_thw=grid_thw, image_patch_id=image_patch_id
|
task_input_ids=input_ids, grid_thw=grid_thw, image_patch_id=image_patch_id
|
||||||
).numpy()
|
).numpy()
|
||||||
|
|
||||||
|
grid_thw = grid_thw.numpy().reshape([-1, 3])
|
||||||
|
inputs["grid_thw"] = grid_thw
|
||||||
|
|
||||||
|
grid_thw = inputs["grid_thw"]
|
||||||
img_boundaries_idx = request.multimodal_img_boundaries[0]
|
img_boundaries_idx = request.multimodal_img_boundaries[0]
|
||||||
img_num_per_boundary = request.multimodal_img_boundaries[1]
|
img_num_per_boundary = request.multimodal_img_boundaries[1]
|
||||||
ori_prompt_len = img_boundaries_idx[-1].item()
|
ori_prompt_len = img_boundaries_idx[-1].item()
|
||||||
grid_thw = grid_thw.numpy().reshape([-1, 3])
|
|
||||||
pre_end_idx = request.num_computed_tokens
|
pre_end_idx = request.num_computed_tokens
|
||||||
new_end_idx = pre_end_idx + num_new_tokens
|
new_end_idx = pre_end_idx + num_new_tokens
|
||||||
if new_end_idx < ori_prompt_len and input_ids[new_end_idx - 1] == image_patch_id:
|
if new_end_idx < ori_prompt_len and input_ids[new_end_idx - 1] == image_patch_id:
|
||||||
@@ -421,9 +426,15 @@ class ResourceManagerV1(ResourceManager):
|
|||||||
self.running.remove(request)
|
self.running.remove(request)
|
||||||
request.status = RequestStatus.FINISHED
|
request.status = RequestStatus.FINISHED
|
||||||
self._free_blocks(request)
|
self._free_blocks(request)
|
||||||
if request.request_id in self.to_be_rescheduled_request_id_set: # finished after preempted, blocks have been recycled.
|
if (
|
||||||
self.to_be_rescheduled_request_id_set.remove(request.request_id) # just remove from to_be_rescheduled_request_id_set
|
request.request_id in self.to_be_rescheduled_request_id_set
|
||||||
if request in self.waiting: # after finished, this request still scheduled from preempted to waiting, unexpected error, should not be here
|
): # finished after preempted, blocks have been recycled.
|
||||||
|
self.to_be_rescheduled_request_id_set.remove(
|
||||||
|
request.request_id
|
||||||
|
) # just remove from to_be_rescheduled_request_id_set
|
||||||
|
if (
|
||||||
|
request in self.waiting
|
||||||
|
): # after finished, this request still scheduled from preempted to waiting, unexpected error, should not be here
|
||||||
raise RuntimeError(f"request {request.request_id} scheduled into waiting list, after finished")
|
raise RuntimeError(f"request {request.request_id} scheduled into waiting list, after finished")
|
||||||
self.tasks_list[request.idx] = None
|
self.tasks_list[request.idx] = None
|
||||||
self.stop_flags[request.idx] = True
|
self.stop_flags[request.idx] = True
|
||||||
|
Reference in New Issue
Block a user