Add print statements
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|