Skip to content

Commit

Permalink
make style
Browse files Browse the repository at this point in the history
  • Loading branch information
gongbaitao committed Feb 21, 2023
1 parent ea71176 commit 6cad05d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/transformers/models/cpmant/modeling_cpmant.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ def forward(
past_key_values (`Tuple[torch.Tensor, torch.Tensor]`, *optional*):
Cached past key and value projection states.
use_cache (`bool`, *optional*):
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
`past_key_values`).
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
(see `past_key_values`).
"""
batch_size = hidden_q.size(0)
len_q = hidden_q.size(1)
Expand Down Expand Up @@ -275,8 +275,8 @@ def forward(
past_key_values (`Tuple(torch.FloatTensor)`, *optional*):
Cached past key and value projection states.
use_cache (`bool`, *optional*):
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
`past_key_values`).
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
(see `past_key_values`).
"""
outputs = self.layernorm_before_attention(hidden_states)
outputs = self.self_attention(outputs, outputs, attention_mask, position_bias, past_key_values, use_cache)
Expand Down Expand Up @@ -391,8 +391,8 @@ def forward(
past_key_values (`Tuple[torch.Tensor, torch.Tensor])`, *optional*):
Cached past key and value projection states
use_cache (`bool`, *optional*):
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
`past_key_values`).
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
(see `past_key_values`).
"""
current_key_value = None
hidden_states = self.self_att(
Expand Down Expand Up @@ -439,8 +439,8 @@ def forward(
past_key_values (`Tuple[torch.Tensor, torch.Tensor])`, *optional*):
Cached past key and value projection states
use_cache (`bool`, *optional*):
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
`past_key_values`).
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
(see `past_key_values`).
"""
if not use_cache:
for layer in self.layers:
Expand Down Expand Up @@ -751,8 +751,8 @@ def forward(
span (`torch.Tensor` of shape `(batch_size, seq_len)`, *optional*):
A contiguous sequence of tokens within the input text.
use_cache (`bool`, *optional*):
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
`past_key_values`).
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
(see `past_key_values`).
"""
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
output_hidden_states = (
Expand Down Expand Up @@ -847,8 +847,8 @@ def forward(
span (`torch.Tensor` of shape `(batch_size, seq_len)`, *optional*):
A contiguous sequence of tokens within the input text.
use_cache (`bool`, *optional*):
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
`past_key_values`).
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
(see `past_key_values`).
"""
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
output_hidden_states = (
Expand Down

0 comments on commit 6cad05d

Please sign in to comment.