Add print statements
Browse files- modeling_cogvlm.py +6 -1
modeling_cogvlm.py
CHANGED
@@ -295,6 +295,8 @@ class CogVLMDecoderLayer(nn.Module):
|
|
295 |
|
296 |
hidden_states = self.input_layernorm(hidden_states)
|
297 |
|
|
|
|
|
298 |
# Self Attention
|
299 |
hidden_states, self_attn_weights, present_key_value = self.self_attn(
|
300 |
hidden_states=hidden_states,
|
@@ -305,6 +307,9 @@ class CogVLMDecoderLayer(nn.Module):
|
|
305 |
output_attentions=output_attentions,
|
306 |
use_cache=use_cache,
|
307 |
)
|
|
|
|
|
|
|
308 |
hidden_states = residual + hidden_states
|
309 |
|
310 |
# Fully Connected
|
@@ -522,7 +527,7 @@ class CogVLMModel(CogVLMPreTrainedModel):
|
|
522 |
if output_hidden_states:
|
523 |
all_hidden_states += (hidden_states,)
|
524 |
|
525 |
-
if idx in [0,
|
526 |
print(f"Hidden states before layer {idx}", hidden_states[0,:3,:3])
|
527 |
|
528 |
past_key_value = past_key_values[idx] if past_key_values is not None else None
|
|
|
295 |
|
296 |
hidden_states = self.input_layernorm(hidden_states)
|
297 |
|
298 |
+
print("Hidden states before self attention:", hidden_states[0,:3,:3])
|
299 |
+
|
300 |
# Self Attention
|
301 |
hidden_states, self_attn_weights, present_key_value = self.self_attn(
|
302 |
hidden_states=hidden_states,
|
|
|
307 |
output_attentions=output_attentions,
|
308 |
use_cache=use_cache,
|
309 |
)
|
310 |
+
|
311 |
+
print("Hidden states after self attention:", hidden_states[0,:3,:3])
|
312 |
+
|
313 |
hidden_states = residual + hidden_states
|
314 |
|
315 |
# Fully Connected
|
|
|
527 |
if output_hidden_states:
|
528 |
all_hidden_states += (hidden_states,)
|
529 |
|
530 |
+
if idx in [0, 1, 2]:
|
531 |
print(f"Hidden states before layer {idx}", hidden_states[0,:3,:3])
|
532 |
|
533 |
past_key_value = past_key_values[idx] if past_key_values is not None else None
|