MCPcopy Create free account
hub / github.com/evilsocket/cake / process_kv_windowed

Method process_kv_windowed

cake-core/src/models/common/cache.rs:173–182  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

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,

Callers 4

forwardMethod · 0.80
test_kv_cache_windowedFunction · 0.80

Calls 1

process_kv_innerMethod · 0.80

Tested by 2

test_kv_cache_windowedFunction · 0.64