Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

disable bfloat16

Daniel Hana731e2fb6c9a
diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py
index f73f0d3ec6d..fbda4916e13 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 65b591adf4e..bb6693e7632 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))