Update modeling_chatglm.py
#24
by
marko1616
- opened
- modeling_chatglm.py +1 -1
modeling_chatglm.py
CHANGED
@@ -976,7 +976,7 @@ class ChatGLMForConditionalGeneration(ChatGLMPreTrainedModel):
|
|
976 |
# only last token for input_ids if past is not None
|
977 |
if position_ids is None:
|
978 |
position_ids = self.get_position_ids(input_ids, device=input_ids.device)
|
979 |
-
if attention_mask is not None:
|
980 |
image_size: int = self.config.vision_config['image_size']
|
981 |
patch_size: int = self.config.vision_config['patch_size']
|
982 |
num_patches = (image_size // patch_size // 2) ** 2
|
|
|
976 |
# only last token for input_ids if past is not None
|
977 |
if position_ids is None:
|
978 |
position_ids = self.get_position_ids(input_ids, device=input_ids.device)
|
979 |
+
if attention_mask is not None and not is_empty(images):
|
980 |
image_size: int = self.config.vision_config['image_size']
|
981 |
patch_size: int = self.config.vision_config['patch_size']
|
982 |
num_patches = (image_size // patch_size // 2) ** 2
|