Lint and fix undefined names (3/N) (#6030)

This commit is contained in:
Chenlei Hu
2024-12-12 15:49:40 -08:00
committed by GitHub
parent d4426dce7c
commit 60749f345d
4 changed files with 4 additions and 4 deletions

View File

@@ -172,7 +172,7 @@ def _get_attention_scores_no_kv_chunking(
del attn_scores
except model_management.OOM_EXCEPTION:
logging.warning("ran out of memory while running softmax in _get_attention_scores_no_kv_chunking, trying slower in place softmax instead")
attn_scores -= attn_scores.max(dim=-1, keepdim=True).values
attn_scores -= attn_scores.max(dim=-1, keepdim=True).values # noqa: F821 attn_scores is not defined
torch.exp(attn_scores, out=attn_scores)
summed = torch.sum(attn_scores, dim=-1, keepdim=True)
attn_scores /= summed