Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
vince62s committed Dec 26, 2023
1 parent d0ec7a8 commit 17373ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions onmt/modules/multi_headed_attn.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,12 @@ def forward(
dim=-2,
)
if sliding_window > 0 and key.size(2) > sliding_window:
self.layer_cache[1]["keys"] = self.layer_cache[1]["keys"][:, :, 1:, :]
self.layer_cache[1]["values"] = self.layer_cache[1]["values"][:, :, 1:, :]
self.layer_cache[1]["keys"] = self.layer_cache[1]["keys"][
:, :, 1:, :
]
self.layer_cache[1]["values"] = self.layer_cache[1]["values"][
:, :, 1:, :
]
context = self.flash_attn_with_kvcache(
query.transpose(1, 2),
self.layer_cache[1]["keys"].transpose(1, 2),
Expand Down

0 comments on commit 17373ca

Please sign in to comment.