mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2026-04-10 12:33:42 +00:00
Remove persistent flag from cache buffers (#916)
This commit is contained in:
committed by
GitHub
parent
c19533851f
commit
a11965fbd9
@@ -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)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user