nielsr HF staff commited on
Commit
23449cd
1 Parent(s): d0bdef6

Add print statements

Browse files
Files changed (1) hide show
  1. visual.py +15 -1
visual.py CHANGED
@@ -90,7 +90,21 @@ class Transformer(nn.Module):
90
  self.layers = nn.ModuleList([TransformerLayer(config) for _ in range(config.num_hidden_layers)])
91
 
92
  def forward(self, hidden_states):
93
- for layer_module in self.layers:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  hidden_states = layer_module(hidden_states)
95
  return hidden_states
96
 
 
90
  self.layers = nn.ModuleList([TransformerLayer(config) for _ in range(config.num_hidden_layers)])
91
 
92
  def forward(self, hidden_states):
93
+
94
+ print("Shape of hidden states before CLIP:", hidden_states.shape)
95
+ torch.save(hidden_states, "hidden_states_before_clip.pt")
96
+
97
+ from huggingface_hub import HfApi
98
+
99
+ api = HfApi()
100
+ api.upload_file(
101
+ path_or_fileobj="hidden_states_before_clip.pt",
102
+ path_in_repo="hidden_states_before_clip.pt",
103
+ repo_id="nielsr/test-cogvlm",
104
+ repo_type="dataset",
105
+ )
106
+
107
+ for idx, layer_module in enumerate(self.layers):
108
  hidden_states = layer_module(hidden_states)
109
  return hidden_states
110