Add print statements
Browse files- modeling_cogvlm.py +24 -0
modeling_cogvlm.py
CHANGED
|
@@ -556,6 +556,9 @@ class CogVLMModel(CogVLMPreTrainedModel):
|
|
| 556 |
hidden_states = inputs_embeds
|
| 557 |
|
| 558 |
torch.save(hidden_states, "initial_hidden_states.pt")
|
|
|
|
|
|
|
|
|
|
| 559 |
|
| 560 |
from huggingface_hub import HfApi
|
| 561 |
|
|
@@ -566,6 +569,27 @@ class CogVLMModel(CogVLMPreTrainedModel):
|
|
| 566 |
repo_id="nielsr/test-cogvlm",
|
| 567 |
repo_type="dataset",
|
| 568 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 569 |
|
| 570 |
# decoder layers
|
| 571 |
all_hidden_states = () if output_hidden_states else None
|
|
|
|
| 556 |
hidden_states = inputs_embeds
|
| 557 |
|
| 558 |
torch.save(hidden_states, "initial_hidden_states.pt")
|
| 559 |
+
torch.save(attention_mask, "initial_attention_mask.pt")
|
| 560 |
+
torch.save(token_type_ids, "initial_token_type_ids.pt")
|
| 561 |
+
torch.save(position_ids, "initial_position_ids.pt")
|
| 562 |
|
| 563 |
from huggingface_hub import HfApi
|
| 564 |
|
|
|
|
| 569 |
repo_id="nielsr/test-cogvlm",
|
| 570 |
repo_type="dataset",
|
| 571 |
)
|
| 572 |
+
api = HfApi()
|
| 573 |
+
api.upload_file(
|
| 574 |
+
path_or_fileobj="initial_attention_mask.pt",
|
| 575 |
+
path_in_repo="initial_attention_mask.pt",
|
| 576 |
+
repo_id="nielsr/test-cogvlm",
|
| 577 |
+
repo_type="dataset",
|
| 578 |
+
)
|
| 579 |
+
api = HfApi()
|
| 580 |
+
api.upload_file(
|
| 581 |
+
path_or_fileobj="initial_token_type_ids.pt",
|
| 582 |
+
path_in_repo="initial_token_type_ids.pt",
|
| 583 |
+
repo_id="nielsr/test-cogvlm",
|
| 584 |
+
repo_type="dataset",
|
| 585 |
+
)
|
| 586 |
+
api = HfApi()
|
| 587 |
+
api.upload_file(
|
| 588 |
+
path_or_fileobj="initial_position_ids.pt",
|
| 589 |
+
path_in_repo="initial_position_ids.pt",
|
| 590 |
+
repo_id="nielsr/test-cogvlm",
|
| 591 |
+
repo_type="dataset",
|
| 592 |
+
)
|
| 593 |
|
| 594 |
# decoder layers
|
| 595 |
all_hidden_states = () if output_hidden_states else None
|