Remove persistent flag from cache buffers (#916)

This commit is contained in:
Sebastian Raschka
2025-11-24 20:10:02 -06:00
committed by GitHub
parent c19533851f
commit a11965fbd9

View File

@@ -55,11 +55,11 @@ To summarize the implementation details, here's a short walkthrough.
### 1. Registering the cache buffers ### 1. Registering the cache buffers
Inside the `MultiHeadAttention` constructor we add two non-persistent buffers, `cache_k` and `cache_v`, which will hold concatenated keys and values across steps: Inside the `MultiHeadAttention` constructor we add two buffers, `cache_k` and `cache_v`, which will hold concatenated keys and values across steps:
```python ```python
self.register_buffer("cache_k", None, persistent=False) self.register_buffer("cache_k", None)
self.register_buffer("cache_v", None, persistent=False) self.register_buffer("cache_v", None)
``` ```