Add print statements
Browse files
visual.py
CHANGED
@@ -106,6 +106,20 @@ class Transformer(nn.Module):
|
|
106 |
|
107 |
for idx, layer_module in enumerate(self.layers):
|
108 |
hidden_states = layer_module(hidden_states)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
return hidden_states
|
110 |
|
111 |
|
|
|
106 |
|
107 |
for idx, layer_module in enumerate(self.layers):
|
108 |
hidden_states = layer_module(hidden_states)
|
109 |
+
|
110 |
+
print("Shape of hidden states after CLIP:", hidden_states.shape)
|
111 |
+
torch.save(hidden_states, "hidden_states_after_clip.pt")
|
112 |
+
|
113 |
+
from huggingface_hub import HfApi
|
114 |
+
|
115 |
+
api = HfApi()
|
116 |
+
api.upload_file(
|
117 |
+
path_or_fileobj="hidden_states_after_clip.pt",
|
118 |
+
path_in_repo="hidden_states_after_clip.pt",
|
119 |
+
repo_id="nielsr/test-cogvlm",
|
120 |
+
repo_type="dataset",
|
121 |
+
)
|
122 |
+
|
123 |
return hidden_states
|
124 |
|
125 |
|