From 6a8563fdfbc80b60167e5c56ffc26471ae5cfc0f Mon Sep 17 00:00:00 2001 From: kevincheng2 Date: Tue, 12 May 2026 17:22:34 +0800 Subject: [PATCH] [BugFix] fix: cast image_mask.any() to bool for task queue serialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Motivation 多模 RL 0 卡场景下,`image_mask.any()` 返回 `numpy.bool_` 类型,通过 task queue 传输时序列化失败导致报错。 ## Modifications - 将 `request.with_image = image_mask.any()` 改为 `request.with_image = bool(image_mask.any())`,转换为 Python 原生 bool 类型 ## Usage or Command 无需额外配置,启动多模 RL 推理服务即可验证: ```bash bash run.sh ``` --- fastdeploy/engine/sched/resource_manager_v1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastdeploy/engine/sched/resource_manager_v1.py b/fastdeploy/engine/sched/resource_manager_v1.py index e3d20cc7d02..f0eec2d75cc 100644 --- a/fastdeploy/engine/sched/resource_manager_v1.py +++ b/fastdeploy/engine/sched/resource_manager_v1.py @@ -802,7 +802,7 @@ def _compute_audio_prefix_count(end_idx, end_patch_idx): num_new_tokens = new_end_idx - pre_end_idx image_mask = input_ids[pre_end_idx:new_end_idx] == image_patch_id - request.with_image = image_mask.any() + request.with_image = bool(image_mask.any()) if request.with_image: pre_boundary_idx = np.searchsorted(img_boundaries_idx, pre_end_idx, side="left").item() if pre_boundary_idx == len(img_boundaries_idx):