Like `process_kv` but caps the KV cache to `window` tokens (sliding window attention).
(
&mut self,
block_idx: usize,
k: Tensor,
v: Tensor,
window: usize,
)
| 171 | |
| 172 | /// Like `process_kv` but caps the KV cache to `window` tokens (sliding window attention). |
| 173 | pub fn process_kv_windowed( |
| 174 | &mut self, |
| 175 | block_idx: usize, |
| 176 | k: Tensor, |
| 177 | v: Tensor, |
| 178 | window: usize, |
| 179 | ) -> Result<(Tensor, Tensor)> { |
| 180 | let limit = window.min(self.max_seq_len); |
| 181 | self.process_kv_inner(block_idx, k, v, limit) |
| 182 | } |
| 183 | |
| 184 | fn process_kv_inner( |
| 185 | &mut self, |