File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -388,6 +388,14 @@ def fast_cross_entropy_loss(
388388 List ,
389389 Tuple ,
390390)
391+
392+ # Transformers 4.47 need Unpack, KwargsForCausalLM
393+ try :
394+ from transformers .models .llama .modeling_llama import Unpack , KwargsForCausalLM
395+ except :
396+ pass
397+ pass
398+
391399import inspect , re
392400function = inspect .getsource (LlamaForCausalLM .forward )
393401function = function .split ("\n " )
Original file line number Diff line number Diff line change @@ -162,6 +162,20 @@ def patch_mistral_nemo_config(config):
162162pass
163163# =============================================
164164
165+ # =============================================
166+ # Weird Databricks errors
167+ from transformers .utils import is_openai_available
168+ if is_openai_available ():
169+ try :
170+ from openai import OpenAI
171+ except :
172+ print ("Unsloth: OpenAI failed to import - ignoring for now." )
173+ import transformers .utils
174+ def _is_openai_available (): return False
175+ transformers .utils .is_openai_available = _is_openai_available
176+ pass
177+ pass
178+
165179# =============================================
166180# Get Flash Attention v2 if Ampere (RTX 30xx, A100)
167181import bitsandbytes as bnb
You can’t perform that action at this time.
0 commit comments