From d98e12624dd753340bcec7c00183b6677732af89 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 17 Oct 2025 04:54:58 -0700 Subject: [PATCH] Missing inspect --- unsloth/device_type.py | 1 + unsloth/models/loader.py | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/unsloth/device_type.py b/unsloth/device_type.py index e04a3c55b8..ac70d26795 100644 --- a/unsloth/device_type.py +++ b/unsloth/device_type.py @@ -25,6 +25,7 @@ __all__ = [ import torch import functools from unsloth_zoo.utils import Version +import inspect @functools.cache def is_hip(): diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index d8548ded24..2b8ad86b25 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -639,15 +639,14 @@ class FastModel(FastBaseModel): "compatible with `full_finetuning=True`. If you wish to use QAT with LoRA, " "please pass in `qat_scheme` in `FastLanguageModel.get_peft_model(...)` instead." ) - - old_model_name = model_name - if not use_exact_model_name: - model_name = get_model_name(model_name, load_in_4bit) - # Check if 4bit is allowed specifically for AMD if not ALLOW_BITSANDBYTES: print("Unsloth: AMD currently is not stable with 4bit bitsandbytes. Disabling for now.") load_in_4bit = False + + old_model_name = model_name + if not use_exact_model_name: + model_name = get_model_name(model_name, load_in_4bit) # Check if pre-quantized models are allowed # For eg AMD GPUs need blocksize = 128, but our pre-quants are blocksize = 64 if not ALLOW_PREQUANTIZED_MODELS and model_name.endswith(("-unsloth-bnb-4bit", "-bnb-4bit")):