Skip to content

Commit fefbd65

Browse files
authored
[SOT] Remove BreakGraph with paddle.maximum (#2731)
* rm if with clip * clip -> maximum * int64 -> int32
1 parent 1eb8ea7 commit fefbd65

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

fastdeploy/model_executor/models/ernie4_5_vl/ernie4_5_vl_moe.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,7 @@ def forward(
393393
token_type_ids = image_mask.cast("int32")
394394
token_num = hidden_states.shape[0]
395395
image_token_num = paddle.count_nonzero(token_type_ids).cast("int32")
396-
text_token_num = ((token_num - image_token_num) if
397-
(token_num - image_token_num) > 0 else 1)
396+
text_token_num = paddle.maximum(token_num - image_token_num, paddle.ones([], dtype="int32"))
398397
if image_mask.any():
399398
hidden_states[image_mask] = image_features.cast(self._dtype)
400399
text_input = paddle.full(

0 commit comments

Comments
 (0)