diff --git a/unsloth/__init__.py b/unsloth/__init__.py index 0105199fba..298ed13399 100644 --- a/unsloth/__init__.py +++ b/unsloth/__init__.py @@ -17,17 +17,20 @@ import importlib import sys from packaging.version import Version -# Define a list of modules to check -MODULES_TO_CHECK = ["bitsandbytes"] +# # 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 +# # 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. +# 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.py index 2d8e6a0748..2368a37672 100644 --- a/unsloth/models/llama.py +++ b/unsloth/models/llama.py @@ -1165,10 +1165,10 @@ class FastLlamaModel: inner_training_loop = Trainer._original_training_loop except: 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_size if 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 // bsz if 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 / 1 bsz = 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!' ) pass inner_training_loop = inner_training_loop.replace( @@ -1783,10 +1786,10 @@ class FastLlamaModel: from transformers.trainer import Trainer if 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!' ) pass diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py index fe2dc06c44..50b09275aa 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"\