Add input NaN debug to trace where NaN starts

This commit is contained in:
2026-05-19 18:15:53 +00:00
parent 4c45d73b82
commit 0316cec6fb

View File

@@ -586,6 +586,12 @@ class DeepseekV4MultiHeadLatentAttentionWrapper(PluggableLayer):
forward_context = get_forward_context()
attn_metadata = forward_context.attn_metadata
# Debug: check input for NaN
import sys as _sys
_hs_nan = torch.isnan(hidden_states).any().item()
if _hs_nan:
print(f"[BLACKWELL] INPUT NaN: cr={self.compress_ratio}", file=_sys.stderr, flush=True)
qr_kv, kv_score, indexer_kv_score, indexer_weights = (
self.attn_gemm_parallel_execute(hidden_states)
)