From c6e9af2e5b69abc8cb332abef3eb101b0d33c63e Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 28 Oct 2024 10:41:31 -0700 Subject: [PATCH] Update _utils.py --- unsloth/models/_utils.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 692f48488c..97b2ea7b7b 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -688,11 +688,15 @@ pass # Also disable compiling on bitsandbytes def patch_compiling_bitsandbytes(): - import peft.tuners.lora.bnb - peft.tuners.lora.bnb.Linear4bit.forward = \ - torch._disable_dynamo(peft.tuners.lora.bnb.Linear4bit.forward) - peft.tuners.lora.bnb.Linear8bitLt.forward = \ - torch._disable_dynamo(peft.tuners.lora.bnb.Linear8bitLt.forward) + # import peft.tuners.lora.bnb + # peft.tuners.lora.bnb.Linear4bit.forward = \ + # torch._disable_dynamo(peft.tuners.lora.bnb.Linear4bit.forward) + # peft.tuners.lora.bnb.Linear8bitLt.forward = \ + # torch._disable_dynamo(peft.tuners.lora.bnb.Linear8bitLt.forward) + # return + import bitsandbytes.nn.modules + bitsandbytes.nn.modules.Linear4bit.forward = \ + torch._disable_dynamo(bitsandbytes.nn.modules.Linear4bit.forward) return pass # =============================================