this is the beginning of the forward function for the encoder-decoder blip model: def…
- User
this is the beginning of the forward function for the encoder-decoder blip model:
def forward( self, input_ids: Optional[torch.Tensor] = None, attention_mask: Optional[torch.Tensor] = None, position_ids: Optional[torch.Tensor] = None, head_mask: Optional[torch.Tensor] = None, inputs_embeds: Optional[torch.Tensor] = None, encoder_embeds: Optional[torch.Tensor] = None, encoder_hidden_states: Optional[torch.Tensor] = None, encoder_attention_mask: Optional[torch.Tensor] = None, past_key_values: Optional[List[torch.FloatTensor]] = None, use_cache: Optional[bool] = None, output_attentions: Optional[bool] = None, output_hidden_states: Optional[bool] = None, return_dict: Optional[bool] = None, is_decoder: Optional[bool] = False, ) -> Union[Tuple[torch.Tensor], BaseModelOutputWithPoolingAndCrossAttentions]: r""" encoder_hidden_states (
torch.FloatTensor, optional): Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if the model is configured as a decoder. encoder_attention_mask (torch.FloatTensor, optional): Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in the cross-attention if the model is configured as a decoder. Mask values selected in[0, 1]: - 1 for tokens that are not masked, - 0 for tokens that are masked. past_key_values (tuple(tuple(torch.FloatTensor)), optional): Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding. Ifpast_key_valuesare used, the user can optionally input only the lastdecoder_input_ids(those that don't have their past key value states given to this model) of shape(batch_size, 1)instead of alldecoder_input_idsof shape(batch_size, sequence_length). use_cache (bool, optional): If set toTrue,past_key_valueskey value states are returned and can be used to speed up decoding (seepast_key_values). """ how are past_key_values computed and what do they contain? In that function they are used everywhere only as arguments. Can I run the code without them and still expect correct results?Also, they are 12 and all of shape torch.Size([1, 12, 1, 64]). Maybe they have something to do with 768 being split into 1121*64? But then why 12?
- Assistant
- User
i have a github branch which is 13 commits ahead and 2 commits behind master. how to bring the modifications from master into my branch?
- Assistant
To bring the modifications from the master branch into your branch, you typically have a couple of options: merging or rebasing. Here's how to do both using Git.
- User
what does -u mean in :
git push -u origin my_branch
- Assistant
The
-uflag in the Git commandgit push -u origin my_branchstands for--set-upstream.Here's what it does:
Explanation of the
-u(or--set-upstream) Flag-
Sets the Upstream Tracking Reference:
- When you use
-u, you're telling Git to link your local branch (my_branchin this case) to the corresponding branch on the remote repository (origin/my_branch). - This means that after you perform this
push, any subsequentgit pullorgit pushcommands executed while on that branch will automatically know to interact withorigin/my_branchon the remote without the need to specify the remote and branch name again.
- When you use
-
Convenience for Future Pushes and Pulls:
-