From ddde04459cdfbc78a87663712c0e8db958bd3da5 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 24 Oct 2024 01:11:20 -0700 Subject: [PATCH] Update _utils.py --- unsloth/models/_utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index bf5216b228..873a2723c2 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -162,6 +162,20 @@ if hasattr(transformers.cache_utils, "DynamicCache") and \ pass # ============================================= +# ============================================= +# Weird Databricks errors +from transformers.utils import is_openai_available +if is_openai_available(): + try: + from openai import OpenAI + except: + print("Unsloth: OpenAI failed to import - ignoring for now.") + import transformers.utils + def _is_openai_available(): return False + transformers.utils.is_openai_available = _is_openai_available + pass +pass + # ============================================= # Get Flash Attention v2 if Ampere (RTX 30xx, A100) import bitsandbytes as bnb