Skip to content

Commit 2f0f780

Browse files
Merge pull request #74 from chichun-charlie-liu/bug_fix
fix: in DQ example, when nbits_kvcache=8, context manager will detect incorrect frame
2 parents 493d58a + 1f0c65c commit 2f0f780

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

fms_mo/dq.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ def run_dq(model_args, data_args, opt_args, fms_mo_args):
207207
else:
208208
act_scales = get_act_scales(model, dq_dataloader, qcfg)
209209
torch.save(act_scales, scale_file)
210-
211210
qmodel_prep(
212211
model,
213212
dq_dataloader,

fms_mo/utils/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ def mockmatmul(mat1, mat2):
115115
while cf.f_back and qbmm_mod is None:
116116
# First frame is QBmm's forward itself, can start searching from previous stack
117117
cf = cf.f_back
118-
if "forward" in cf.f_code.co_name or "_attn" in cf.f_code.co_name:
118+
if (
119+
"forward" in cf.f_code.co_name or "_attn" in cf.f_code.co_name
120+
) and "self" in cf.f_locals:
119121
mod_calling_bmm_function = cf.f_locals["self"]
120122
# If not found -> default to torch.bmm
121123
qbmm_mod = getattr(

0 commit comments

Comments
 (0)