[Bugfix] Fix /wake_up crash on hybrid models (Mamba/DeltaNet) (#41602)
Signed-off-by: Kevin Glynn <kevglynn@gmail.com>
This commit is contained in:
@@ -991,9 +991,16 @@ class GPUModelRunner(
|
||||
return
|
||||
|
||||
kv_caches = getattr(self, "kv_caches", [])
|
||||
for cache_tensor in kv_caches:
|
||||
if cache_tensor is not None:
|
||||
cache_tensor.zero_()
|
||||
for cache_entry in kv_caches:
|
||||
if cache_entry is None:
|
||||
continue
|
||||
# Hybrid models (Mamba, DeltaNet) store per-layer state as a
|
||||
# list of tensors rather than a single tensor.
|
||||
if isinstance(cache_entry, list):
|
||||
for t in cache_entry:
|
||||
t.zero_()
|
||||
else:
|
||||
cache_entry.zero_()
|
||||
|
||||
k_attr_names = ("_k_scale", "k_scale")
|
||||
v_attr_names = ("_v_scale", "v_scale")
|
||||
|
||||
Reference in New Issue
Block a user