From 6ba3138d7cfaa3159a548fce56ad62aece6c62b2 Mon Sep 17 00:00:00 2001 From: zxue2 Date: Mon, 30 Jun 2025 14:14:01 +0800 Subject: [PATCH] Fix ambiguous boolean evaluation in bert.py (#13236) Signed-off-by: Xue, Zhan --- python/llm/src/ipex_llm/transformers/models/bert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/llm/src/ipex_llm/transformers/models/bert.py b/python/llm/src/ipex_llm/transformers/models/bert.py index 2f1c4f56..95002c06 100644 --- a/python/llm/src/ipex_llm/transformers/models/bert.py +++ b/python/llm/src/ipex_llm/transformers/models/bert.py @@ -119,7 +119,7 @@ def encoder_forward( output_hidden_states: Optional[bool] = False, return_dict: Optional[bool] = True, ): - if attention_mask and not attention_mask.any(): + if attention_mask is not None and not attention_mask.any(): attention_mask = None return BertEncoder.forward( self=self,