nielsr HF staff commited on
Commit
603c7eb
1 Parent(s): 11f7ea9

Add print statements

Browse files
Files changed (1) hide show
  1. modeling_cogvlm.py +11 -0
modeling_cogvlm.py CHANGED
@@ -648,6 +648,17 @@ class CogVLMModel(CogVLMPreTrainedModel):
648
  )
649
  hidden_states = layer_outputs[0]
650
 
 
 
 
 
 
 
 
 
 
 
 
651
  if use_cache:
652
  next_decoder_cache += (layer_outputs[2 if output_attentions else 1],)
653
 
 
648
  )
649
  hidden_states = layer_outputs[0]
650
 
651
+ if idx == 0:
652
+ torch.save(hidden_states, "hidden_states_after_layer_0.pt")
653
+
654
+ api = HfApi()
655
+ api.upload_file(
656
+ path_or_fileobj="hidden_states_after_layer_0.pt",
657
+ path_in_repo="hidden_states_after_layer_0.pt",
658
+ repo_id="nielsr/test-cogvlm",
659
+ repo_type="dataset",
660
+ )
661
+
662
  if use_cache:
663
  next_decoder_cache += (layer_outputs[2 if output_attentions else 1],)
664