mirror of
https://github.com/RYDE-WORK/ktransformers.git
synced 2026-02-07 07:03:27 +08:00
Fix NoneType object has no attribute zero_
This commit is contained in:
parent
3c6035aa8a
commit
4516282ccc
@ -172,7 +172,8 @@ class StaticCache(transformers.StaticCache):
|
|||||||
for layer_idx in range(len(self.key_cache)):
|
for layer_idx in range(len(self.key_cache)):
|
||||||
# In-place ops prevent breaking the static address
|
# In-place ops prevent breaking the static address
|
||||||
self.key_cache[layer_idx].zero_()
|
self.key_cache[layer_idx].zero_()
|
||||||
self.value_cache[layer_idx].zero_()
|
if self.value_cache[layer_idx] is not None:
|
||||||
|
self.value_cache[layer_idx].zero_()
|
||||||
|
|
||||||
def get_max_cache_shape(self) -> Tuple[int, int, int, int]:
|
def get_max_cache_shape(self) -> Tuple[int, int, int, int]:
|
||||||
"""Returns the maximum shape of the cache."""
|
"""Returns the maximum shape of the cache."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user