Upload modeling_dplm2.py with huggingface_hub
Browse files- modeling_dplm2.py +1 -2
modeling_dplm2.py
CHANGED
|
@@ -429,9 +429,8 @@ def get_attention_mask(
|
|
| 429 |
if attention_mask is None:
|
| 430 |
flex_block_mask = None
|
| 431 |
else:
|
| 432 |
-
sequence_ids = torch.where(token_attention_mask, 1, -1)
|
| 433 |
def mask_mod(batch_idx, head_idx, q_idx, kv_idx):
|
| 434 |
-
return (
|
| 435 |
|
| 436 |
flex_block_mask = create_block_mask(
|
| 437 |
mask_mod,
|
|
|
|
| 429 |
if attention_mask is None:
|
| 430 |
flex_block_mask = None
|
| 431 |
else:
|
|
|
|
| 432 |
def mask_mod(batch_idx, head_idx, q_idx, kv_idx):
|
| 433 |
+
return (token_attention_mask[batch_idx, q_idx] == token_attention_mask[batch_idx, kv_idx]) & (token_attention_mask[batch_idx, q_idx] != 0)
|
| 434 |
|
| 435 |
flex_block_mask = create_block_mask(
|
| 436 |
mask_mod,
|