From fefbd65cf89ef364ce710437cfbd69f99c0dc9b7 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 8 Jul 2025 11:44:25 +0800 Subject: [PATCH] [SOT] Remove BreakGraph with `paddle.maximum` (#2731) * rm if with clip * clip -> maximum * int64 -> int32 --- .../model_executor/models/ernie4_5_vl/ernie4_5_vl_moe.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fastdeploy/model_executor/models/ernie4_5_vl/ernie4_5_vl_moe.py b/fastdeploy/model_executor/models/ernie4_5_vl/ernie4_5_vl_moe.py index a08433a57..a89fe6816 100644 --- a/fastdeploy/model_executor/models/ernie4_5_vl/ernie4_5_vl_moe.py +++ b/fastdeploy/model_executor/models/ernie4_5_vl/ernie4_5_vl_moe.py @@ -393,8 +393,7 @@ class Ernie4_5_VLModel(nn.Layer): token_type_ids = image_mask.cast("int32") token_num = hidden_states.shape[0] image_token_num = paddle.count_nonzero(token_type_ids).cast("int32") - text_token_num = ((token_num - image_token_num) if - (token_num - image_token_num) > 0 else 1) + text_token_num = paddle.maximum(token_num - image_token_num, paddle.ones([], dtype="int32")) if image_mask.any(): hidden_states[image_mask] = image_features.cast(self._dtype) text_input = paddle.full(