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,