Update bert_layers.py
Browse files- bert_layers.py +3 -3
bert_layers.py
CHANGED
@@ -465,7 +465,7 @@ class BertEncoder(nn.Module):
|
|
465 |
attn_mask=attention_mask,
|
466 |
bias=alibi_attn_mask)
|
467 |
# JAANDOUI
|
468 |
-
print(f'Inner Attention: {attention_weights}')
|
469 |
print(f'Inner Attention shape: {attention_weights.shape}')
|
470 |
all_attention_weights.append(attention_weights) # Store attention weights
|
471 |
if output_all_encoded_layers:
|
@@ -501,8 +501,8 @@ class BertEncoder(nn.Module):
|
|
501 |
attn_mask=attention_mask,
|
502 |
bias=alibi_attn_mask)
|
503 |
all_attention_weights.append(attention_weights) # JAANDOUI: appending the attention of different layers together.
|
504 |
-
print(f'here is the matrix of attentions inside encoder: \n {all_attention_weights}')
|
505 |
-
print(f'and this is the shape inside encoder: \n {all_attention_weights.shape}')
|
506 |
# print(f'NUMBER6: {all_attention_weights}')
|
507 |
if not output_all_encoded_layers:
|
508 |
all_encoder_layers.append(hidden_states)
|
|
|
465 |
attn_mask=attention_mask,
|
466 |
bias=alibi_attn_mask)
|
467 |
# JAANDOUI
|
468 |
+
# print(f'Inner Attention: {attention_weights}')
|
469 |
print(f'Inner Attention shape: {attention_weights.shape}')
|
470 |
all_attention_weights.append(attention_weights) # Store attention weights
|
471 |
if output_all_encoded_layers:
|
|
|
501 |
attn_mask=attention_mask,
|
502 |
bias=alibi_attn_mask)
|
503 |
all_attention_weights.append(attention_weights) # JAANDOUI: appending the attention of different layers together.
|
504 |
+
# print(f'here is the matrix of attentions inside encoder: \n {all_attention_weights}')
|
505 |
+
print(f'and this is the shape inside encoder: \n {all_attention_weights[0].shape}')
|
506 |
# print(f'NUMBER6: {all_attention_weights}')
|
507 |
if not output_all_encoded_layers:
|
508 |
all_encoder_layers.append(hidden_states)
|