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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Bug fixes
Daniel Hancdd961d2c138
diff --git a/unsloth/__init__.py b/unsloth/__init__.pyindex db54c9a1694..dd526dc3cce 100644--- a/unsloth/__init__.py+++ b/unsloth/__init__.py@@ -11,10 +11,8 @@# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.-import os-import warnings-import importlib-import sys++import warnings, importlib, sysfrom packaging.version import Version# # Define a list of modules to check@@ -60,9 +58,8 @@ except:"We have some installation instructions on our Github page.")pass-import os, re+import os, re, subprocess, inspectimport numpy as np-import subprocess# Hugging Face Hub faster downloads (only enable during Colab and Kaggle sessions)keynames = "\n" + "\n".join(os.environ.keys())@@ -83,12 +80,12 @@ elif (major_torch == 2) and (minor_torch < 2):del os.environ["PYTORCH_CUDA_ALLOC_CONF"]pass-# Torch 2.5 has including_emulation+# Torch 2.4 has including_emulationmajor_version, minor_version = torch.cuda.get_device_capability()SUPPORTS_BFLOAT16 = (major_version >= 8)-if (major_torch == 2) and (minor_torch >= 5):- old_is_bf16_supported = torch.cuda.is_bf16_supported+old_is_bf16_supported = torch.cuda.is_bf16_supported+if "including_emulation" in str(inspect.signature(old_is_bf16_supported)):def is_bf16_supported(including_emulation = False):return old_is_bf16_supported(including_emulation)torch.cuda.is_bf16_supported = is_bf16_supporteddiff --git a/unsloth/models/loader.py b/unsloth/models/loader.pyindex e260017fb9c..02ed00f5cd1 100644--- a/unsloth/models/loader.py+++ b/unsloth/models/loader.py@@ -169,13 +169,23 @@ class FastLanguageModel(FastLlamaModel):autoconfig_error = Nonepeft_error = Nonetry:- model_config = AutoConfig.from_pretrained(model_name, token = token, revision = revision)+ model_config = AutoConfig.from_pretrained(+ model_name,+ token = token,+ revision = revision,+ trust_remote_code = trust_remote_code,+ )is_model = Trueexcept Exception as error:autoconfig_error = str(error)is_model = Falsetry:- peft_config = PeftConfig .from_pretrained(model_name, token = token, revision = revision)+ peft_config = PeftConfig.from_pretrained(+ model_name,+ token = token,+ revision = revision,+ trust_remote_code = trust_remote_code,+ )is_peft = Trueexcept Exception as error:peft_error = str(error)@@ -207,7 +217,12 @@ class FastLanguageModel(FastLlamaModel):if is_peft:# Check base model again for PEFTmodel_name = get_model_name(peft_config.base_model_name_or_path, load_in_4bit)- model_config = AutoConfig.from_pretrained(model_name, token = token, revision = revision)+ model_config = AutoConfig.from_pretrained(+ model_name,+ token = token,+ revision = revision,+ trust_remote_code = trust_remote_code,+ )passif not was_disabled: enable_progress_bars()@@ -340,10 +355,11 @@ class FastLanguageModel(FastLlamaModel):token = token,revision = revision,is_trainable = True,+ trust_remote_code = trust_remote_code,)# Patch it as well!model = dispatch_model.patch_peft_model(model, use_gradient_checkpointing)passreturn model, tokenizerpass-pass+pass\ No newline at end of file