Skip to content

Commit f7ea4ce

Browse files
committed
[Enhance][Temp] add environ var that serves as switch for attn_lse hook
1 parent 0a5f008 commit f7ea4ce

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

xtuner/v1/utils/internal_metrics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from collections import defaultdict
2+
import os
23
import torch
34
import torch.distributed as dist
45
from torch import nn
@@ -72,6 +73,8 @@ def calculate_module_weight_rms(self, module: nn.Module, layer_name: str, dtype:
7273

7374
def register_attn_extra_info_hook(self, module: nn.Module):
7475
"""Register attention extra info hook as a forward hook"""
76+
if os.getenv("DISABLE_ATTN_MONITOR_HOOK", "0") == "1":
77+
return
7578
def hook(module, input, output):
7679
extra_info = output[1]
7780
if extra_info.get("softmax_lse", None) is not None:

0 commit comments

Comments
 (0)