From 8766b15f9ba841ca987807fa356fbe2676be3836 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 17 Mar 2025 18:28:46 -0700 Subject: [PATCH] disable bfloat16 --- unsloth/models/loader.py | 10 +++++----- unsloth/models/vision.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index f73f0d3ec6..fbda4916e1 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -462,11 +462,11 @@ class FastModel(FastBaseModel): if token is None: token = get_token() SUPPORTS_BFLOAT16 = is_bfloat16_supported() - if dtype is None: - dtype = torch.float16 if not SUPPORTS_BFLOAT16 else torch.bfloat16 - elif dtype == torch.bfloat16 and not SUPPORTS_BFLOAT16: - logger.warning_once("Device does not support bfloat16. Will change to float16.") - dtype = torch.float16 + # if dtype is None: + # dtype = torch.float16 if not SUPPORTS_BFLOAT16 else torch.bfloat16 + # elif dtype == torch.bfloat16 and not SUPPORTS_BFLOAT16: + # logger.warning_once("Device does not support bfloat16. Will change to float16.") + # dtype = torch.float16 assert(dtype in (torch.float16, torch.bfloat16, torch.float32)) patch_compiled_autograd() diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py index 65b591adf4..bb6693e763 100644 --- a/unsloth/models/vision.py +++ b/unsloth/models/vision.py @@ -202,11 +202,11 @@ class FastBaseModel: get_statistics() # For debugging - we use a download counter to see if environments are not breaking - if dtype is None: - dtype = torch.float16 if not SUPPORTS_BFLOAT16 else torch.bfloat16 - elif dtype == torch.bfloat16 and not SUPPORTS_BFLOAT16: - logger.warning_once("Device does not support bfloat16. Will change to float16.") - dtype = torch.float16 + # if dtype is None: + # dtype = torch.float16 if not SUPPORTS_BFLOAT16 else torch.bfloat16 + # elif dtype == torch.bfloat16 and not SUPPORTS_BFLOAT16: + # logger.warning_once("Device does not support bfloat16. Will change to float16.") + # dtype = torch.float16 assert(dtype in (torch.float16, torch.bfloat16, torch.float32))