From 7ee1a4792d6a2d3fa7bea83c76bdf497157ac4af Mon Sep 17 00:00:00 2001 From: jiqing-feng Date: Sat, 14 Sep 2024 08:46:55 -0400 Subject: [PATCH] check grad before using ipex --- bitsandbytes/nn/modules.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bitsandbytes/nn/modules.py b/bitsandbytes/nn/modules.py index ad424a6f4..32854413f 100644 --- a/bitsandbytes/nn/modules.py +++ b/bitsandbytes/nn/modules.py @@ -471,6 +471,7 @@ def forward(self, x: torch.Tensor): and not hasattr(self.weight.quant_state, "op_context") and self.weight.quant_state.shape[1] % self.weight.quant_state.blocksize == 0 and self.weight.quant_state.quant_type == "nf4" + and x.requires_grad == False ): enable_ipex_fusion(self.weight, self.weight.quant_state)