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
Nightly (#676)
Daniel Hancfddc79bc8be
diff --git a/unsloth/__init__.py b/unsloth/__init__.pyindex 0105199fba7..298ed13399f 100644--- a/unsloth/__init__.py+++ b/unsloth/__init__.py@@ -17,17 +17,20 @@ import importlibimport sysfrom packaging.version import Version-# Define a list of modules to check-MODULES_TO_CHECK = ["bitsandbytes"]--# Check if any of the modules in the list have been imported-for module in MODULES_TO_CHECK:- if module in sys.modules:- raise ImportError(f"Unsloth: Please import Unsloth before {module}.")- pass-pass--# Currently only supports 1 GPU, or else seg faults will occur.+# # Define a list of modules to check+# MODULES_TO_CHECK = ["bitsandbytes"]++# # Check if any of the modules in the list have been imported+# for module in MODULES_TO_CHECK:+# if module in sys.modules:+# raise ImportError(f"Unsloth: Please import Unsloth before {module}.")+# pass+# pass++# Unsloth currently does not work on multi GPU setups - sadly we are a 2 brother team so+# enabling it will require much more work, so we have to prioritize. Please understand!+# We do have a beta version, which you can contact us about!+# Thank you for your understanding and we appreciate it immensely!if "CUDA_VISIBLE_DEVICES" in os.environ:os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"devices = os.environ["CUDA_VISIBLE_DEVICES"]@@ -36,6 +39,10 @@ if "CUDA_VISIBLE_DEVICES" in os.environ:first_id = devices.split(",")[0]warnings.warn(f"Unsloth: 'CUDA_VISIBLE_DEVICES' is currently {devices} \n"\+ "Unsloth currently does not work on multi GPU setups - sadly we are a 2 brother team so "\+ "enabling it will require much more work, so we have to prioritize. Please understand!"\+ "We do have a beta version, which you can contact us about!\n"\+ "Thank you for your understanding and we appreciate it immensely!\n\n"\"Multiple CUDA devices detected but we require a single device.\n"\f"We will override CUDA_VISIBLE_DEVICES to first device: {first_id}.")diff --git a/unsloth/models/llama.py b/unsloth/models/llama.pyindex 2d8e6a07481..2368a376726 100644--- a/unsloth/models/llama.py+++ b/unsloth/models/llama.py@@ -1165,10 +1165,10 @@ class FastLlamaModel:inner_training_loop = Trainer._original_training_loopexcept:raise RuntimeError(- "Our OSS was designed for people with few GPU resources to level the playing field.\n"- "The OSS Apache 2 license only supports one GPU - please obtain a commercial license.\n"- "We're a 2 person team, so we still have to fund our development costs - thanks!\n"- "If you don't, please consider at least sponsoring us through Ko-fi! Appreciate it!",+ 'Unsloth currently does not work on multi GPU setups - sadly we are a 2 brother team so '\+ 'enabling it will require much more work, so we have to prioritize. Please understand!\n'\+ 'We do have a separate beta version, which you can contact us about!\n'\+ 'Thank you for your understanding and we appreciate it immensely!')pass@@ -1201,7 +1201,10 @@ class FastLlamaModel:output = re.findall(rb'([\\d]{1,})[\\s]{1,}M', output)output = sum(int(x.decode('utf-8'))/1024 > 4 for x in output)if output > 1: raise RuntimeError(- 'Error: More than 1 GPUs have a lot of VRAM usage. Please obtain a commercial license.')+ 'Unsloth currently does not work on multi GPU setups - sadly we are a 2 brother team so '\\+ 'enabling it will require much more work, so we have to prioritize. Please understand!\\n'\\+ 'We do have a separate beta version, which you can contact us about!\\n'\\+ 'Thank you for your understanding and we appreciate it immensely!')for _ in range(3):gc.collect()torch.cuda.empty_cache()"""@@ -1214,10 +1217,10 @@ class FastLlamaModel:args.gradient_accumulation_steps // self._train_batch_sizeif n_total_devices > 1:logger.warning_once(- "* Our OSS was designed for people with few GPU resources to level the playing field.\\n"- "* The OSS Apache 2 license only supports one GPU - please obtain a commercial license.\\n"- "* We're a 2 person team, so we still have to fund our development costs - thanks!\\n"- "* If you don't, please consider at least sponsoring us through Ko-fi! Appreciate it!",+ '* Unsloth currently does not work on multi GPU setups - sadly we are a 2 brother team so ' \\+ '* enabling it will require much more work, so we have to prioritize. Please understand!\\n' \\+ '* We do have a separate beta version, which you can contact us about!\\n'\\+ '* Thank you for your understanding and we appreciate it immensely!')debug_info ="""debug_info = debug_info.split('\n')@@ -1244,10 +1247,10 @@ class FastLlamaModel:n_total_devices = total_batches // ga // bszif n_total_devices > 1:logger.warning_once(- "* Our OSS was designed for people with few GPU resources to level the playing field.\\n"- "* The OSS Apache 2 license only supports one GPU - please obtain a commercial license.\\n"- "* We're a 2 person team, so we still have to fund our development costs - thanks!\\n"- "* If you don't, please consider at least sponsoring us through Ko-fi! Appreciate it!",+ '* Unsloth currently does not work on multi GPU setups - sadly we are a 2 brother team so ' \\+ '* enabling it will require much more work, so we have to prioritize. Please understand!\\n' \\+ '* We do have a separate beta version, which you can contact us about!\\n'\\+ '* Thank you for your understanding and we appreciate it immensely!')divisor = n_total_devices / 1bsz = self._train_batch_size = max(int(bsz / divisor), 1)@@ -1273,10 +1276,10 @@ class FastLlamaModel:)if "n_total_devices >" not in inner_training_loop:raise RuntimeError(- "Our OSS was designed for people with few GPU resources to level the playing field.\n"- "The OSS Apache 2 license only supports one GPU - please obtain a commercial license.\n"- "We're a 2 person team, so we still have to fund our development costs - thanks!\n"- "If you don't, please consider at least sponsoring us through Ko-fi! Appreciate it!",+ 'Unsloth currently does not work on multi GPU setups - sadly we are a 2 brother team so '\+ 'enabling it will require much more work, so we have to prioritize. Please understand!\n'\+ 'We do have a separate beta version, which you can contact us about!\n'\+ 'Thank you for your understanding and we appreciate it immensely!')passinner_training_loop = inner_training_loop.replace(@@ -1783,10 +1786,10 @@ class FastLlamaModel:from transformers.trainer import Trainerif Trainer._inner_training_loop.__name__ != "_fast_inner_training_loop":raise RuntimeError(- "Our OSS was designed for people with few GPU resources to level the playing field.\n"- "The OSS Apache 2 license only supports one GPU - please obtain a commercial license.\n"- "We're a 2 person team, so we still have to fund our development costs - thanks!\n"- "If you don't, please consider at least sponsoring us through Ko-fi! Appreciate it!",+ 'Unsloth currently does not work on multi GPU setups - sadly we are a 2 brother team so '\+ 'enabling it will require much more work, so we have to prioritize. Please understand!\n'\+ 'We do have a separate beta version, which you can contact us about!\n'\+ 'Thank you for your understanding and we appreciate it immensely!')passdiff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.pyindex fe2dc06c44b..50b09275aa4 100644--- a/unsloth/tokenizer_utils.py+++ b/unsloth/tokenizer_utils.py@@ -954,7 +954,7 @@ def patch_sft_trainer_tokenizer():"\n"\"if self._inner_training_loop.__name__ != '_fast_inner_training_loop':\n"\" raise RuntimeError(\n"\- " 'Do not edit specific areas of the Unsloth codebase or you will get CUDA segfaults.'\n"\+ " 'Please do not edit specific areas of the Unsloth codebase or you will get CUDA segfaults.'\n"\" )\n"\"pass\n"\"n_devices = torch.cuda.device_count()\n"\@@ -964,7 +964,10 @@ def patch_sft_trainer_tokenizer():"output = re.findall(rb'([\\d]{1,})[\\s]{1,}M', output)\n"\"output = sum(int(x.decode('utf-8'))/1024 > 4 for x in output)\n"\"if output > 1: raise RuntimeError(\n"\- " 'Error: More than 1 GPUs have a lot of VRAM usage. Please obtain a commercial license.')\n"\+ " 'Unsloth currently does not work on multi GPU setups - sadly we are a 2 brother team so '\\\n"\+ " 'enabling it will require much more work, so we have to prioritize. Please understand!\\n'\\\n"\+ " 'We do have a separate beta version, which you can contact us about!\\n'\\\n"\+ " 'Thank you for your understanding and we appreciate it immensely!')\n"\"for _ in range(3):\n"\" gc.collect()\n"\" torch.cuda.empty_cache()\n"\