diff --git a/unsloth/__init__.py b/unsloth/__init__.py index 1c168d7a72..8aa50792dc 100644 --- a/unsloth/__init__.py +++ b/unsloth/__init__.py @@ -203,15 +203,18 @@ if DEVICE_TYPE == "cuda": del major_version, minor_version elif DEVICE_TYPE == "hip": SUPPORTS_BFLOAT16 = torch.cuda.is_bf16_supported() + def is_bf16_supported(): return SUPPORTS_BFLOAT16 elif DEVICE_TYPE == "xpu": # torch.xpu.is_bf16_supported() does not have including_emulation # set SUPPORTS_BFLOAT16 as torch.xpu.is_bf16_supported() SUPPORTS_BFLOAT16 = torch.xpu.is_bf16_supported() + def is_bf16_supported(): return SUPPORTS_BFLOAT16 + # For Gradio HF Spaces? # if "SPACE_AUTHOR_NAME" not in os.environ and "SPACE_REPO_NAME" not in os.environ: import triton diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py index 15a7dd5515..b03f1c6d15 100644 --- a/unsloth/models/vision.py +++ b/unsloth/models/vision.py @@ -783,7 +783,10 @@ class FastBaseModel: **kwargs, ) try: - from unsloth_zoo.temporary_patches.misc import patch_deepseek_ocr_masked_scatter + from unsloth_zoo.temporary_patches.misc import ( + patch_deepseek_ocr_masked_scatter, + ) + patch_deepseek_ocr_masked_scatter() except Exception: pass diff --git a/unsloth/save.py b/unsloth/save.py index 11e70a5dee..32c8889eb6 100644 --- a/unsloth/save.py +++ b/unsloth/save.py @@ -1998,8 +1998,7 @@ def unsloth_save_pretrained_gguf( except Exception as e: if os.environ.get("UNSLOTH_GGUF_OFFLINE", "0") == "1": print( - "Unsloth: GGUF conversion skipped due to offline mode. " - f"Reason: {e}" + "Unsloth: GGUF conversion skipped due to offline mode. " f"Reason: {e}" ) all_file_locations = [] want_full_precision = None