nielsr HF staff commited on
Commit
c26e99e
1 Parent(s): 5816dbb

Add print statements

Browse files
Files changed (1) hide show
  1. modeling_cogvlm.py +10 -4
modeling_cogvlm.py CHANGED
@@ -241,10 +241,6 @@ class VisionExpertAttention(nn.Module):
241
  key_states = self._transpose_for_scores(key_states) # B, H, L, HD
242
  value_states = self._transpose_for_scores(value_states) # B, H, L, HD
243
 
244
- if print_values:
245
- print("Shape of query_states:", query_states.shape)
246
- print("First values of query_states:", query_states[0,0,:3,:3])
247
-
248
  # if print_values:
249
 
250
  # torch.save(query_states, "query_states.pt")
@@ -287,6 +283,16 @@ class VisionExpertAttention(nn.Module):
287
 
288
  past_key_value = (key_states, value_states) if use_cache else None
289
 
 
 
 
 
 
 
 
 
 
 
290
  context_layer = attention_fn(
291
  query_layer=query_states, key_layer=key_states, value_layer=value_states, attention_mask=attention_mask,
292
  scaling_attention_score=True, attention_dropout=None)
 
241
  key_states = self._transpose_for_scores(key_states) # B, H, L, HD
242
  value_states = self._transpose_for_scores(value_states) # B, H, L, HD
243
 
 
 
 
 
244
  # if print_values:
245
 
246
  # torch.save(query_states, "query_states.pt")
 
283
 
284
  past_key_value = (key_states, value_states) if use_cache else None
285
 
286
+ if print_values:
287
+ print("Shape of query_states:", query_states.shape)
288
+ print("First values of query_states:", query_states[0,0,:3,:3])
289
+
290
+ print("Shape of key_states:", key_states.shape)
291
+ print("First values of key_states:", key_states[0,0,:3,:3])
292
+
293
+ print("Shape of value_states:", value_states.shape)
294
+ print("First values of value_states:", value_states[0,0,:3,:3])
295
+
296
  context_layer = attention_fn(
297
  query_layer=query_states, key_layer=key_states, value_layer=value_states, attention_mask=attention_mask,
298
  scaling_attention_score=True, attention_dropout=None)