From ec7400b552b4d69e804bb37c76ad8d892ab3a95b Mon Sep 17 00:00:00 2001 From: Roland Tannous <115670425+rolandtannous@users.noreply.github.com> Date: Mon, 30 Jun 2025 16:02:57 +0300 Subject: [PATCH 1/5] Added conda/mamba section to blackwell installation readme (#2817) * Added conda/mamba section to blackwell installation readme * fix conda creation suffix and vllm install syntax --- blackwell/README.md | 138 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 114 insertions(+), 24 deletions(-) diff --git a/blackwell/README.md b/blackwell/README.md index fdf5d2bc90..84dfdc84d3 100644 --- a/blackwell/README.md +++ b/blackwell/README.md @@ -1,30 +1,32 @@ -## Unsloth Blackwell Compatibility +# Unsloth Blackwell Compatibility -### Overview +## Overview -`Blackwell` (`sm100+`) requires all dependent libraries to be compiled with `cuda 12.8`. +`Blackwell` (`sm100+`) requires all dependent libraries to be compiled with `cuda 12.8`. The core libs for running unsloth which have dependencies on `CUDA` version are: - `bitsandbytes` - already has wheels built with `CUDA 12.8` so `pip install` should work out of the box - `triton` - requires `triton>=3.3.1` -- `torch` - requires installing with `pip install torch --extra-index-url https://download.pytorch.org/whl/cu128` +- `torch` - requires installing with `pip install torch --extra-index-url https://download.pytorch.org/whl/cu128` - `vllm` - safest is to use the nightly build: `uv pip install -U vllm --torch-backend=cu128 --extra-index-url https://wheels.vllm.ai/nightly` - `xformers` - as of 6/26, `xformers` wheels are not yet built with `sm100+` enabled as support was only recently [added](https://github.com/facebookresearch/xformers/commit/d9b3b6e2b38ca485c89507ef8ac1fbef2723cdfa) so will require a source build (see below). - -### Installation + +## Installation + +### Using uv The installation order is important, since we want the overwrite bundled dependencies with specific versions (namely, `xformers` and `triton`). -1) I prefer to use `uv` over `pip` as it's faster and better for resolving dependencies, especially for libraries which depend on `torch` but for which a specific `CUDA` version is required per this scenario. - +1) I prefer to use `uv` over `pip` as it's faster and better for resolving dependencies, especially for libraries which depend on `torch` but for which a specific `CUDA` version is required per this scenario. + Install `uv` - + ```bash curl -LsSf https://astral.sh/uv/install.sh | sh && source $HOME/.local/bin/env ``` - + Create a project dir and venv: - + ```bash mkdir `unsloth-blackwell` && cd `unsloth-blackwell` uv venv .venv --python=3.12 --seed @@ -32,7 +34,7 @@ The installation order is important, since we want the overwrite bundled depende ``` 2) Install `vllm` - + ```bash uv pip install -U vllm --torch-backend=cu128 --extra-index-url https://wheels.vllm.ai/nightly ``` @@ -40,48 +42,136 @@ The installation order is important, since we want the overwrite bundled depende Note that we have to specify `cu128`, otherwise `vllm` will install `torch==2.7.0` but with `cu126`. 3) Install `unsloth` dependencies - + ```bash uv pip install unsloth unsloth_zoo bitsandbytes ``` 4) Download and build `xformers` - + ```bash # First uninstall xformers installed by previous libraries uv pip uninstall xformers - + # Clone and build git clone --depth=1 https://github.com/facebookresearch/xformers --recursive cd xformers export TORCH_CUDA_ARCH_LIST="12.0" python setup.py install ``` - + Note that we have to explicitly set `TORCH_CUDA_ARCH_LIST=12.0`. 5) Update `triton` - + ```bash uv pip install -U triton>=3.3.1 ``` - + `triton>=3.3.1` is required for `Blackwell` support. -6) `transformers` - `transformers >= 4.53.0` breaks `unsloth` inference. Specifically, `transformers` with `gradient_checkpointing` enabled will automatically [switch off caching](https://github.com/huggingface/transformers/blob/67ddc82fbc7e52c6f42a395b4a6d278c55b77a39/src/transformers/modeling_layers.py#L52-L59). - +6) `transformers` + `transformers >= 4.53.0` breaks `unsloth` inference. Specifically, `transformers` with `gradient_checkpointing` enabled will automatically [switch off caching](https://github.com/huggingface/transformers/blob/67ddc82fbc7e52c6f42a395b4a6d278c55b77a39/src/transformers/modeling_layers.py#L52-L59). + When using `unsloth` `FastLanguageModel` to `generate` directly after training with `use_cache=True`, this will result in mismatch between expected and actual outputs [here](https://github.com/unslothai/unsloth/blob/bfa6a3678e2fb8097c5ece41d095a8051f099db3/unsloth/models/llama.py#L939). - + Temporary solution is to switch off `gradient_checkpointing` (e.g., `model.disable_gradient_checkpointing()`) before generation if using `4.53.0` or stick with `4.52.4` for now: - + ```bash uv pip install -U transformers==4.52.4 ``` + +### Using conda or mamba + +1) Install `conda/mamba` + + ```bash + curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" + ``` + + Run the installation script + ```bash + bash Miniforge3-$(uname)-$(uname -m).sh + ``` + + Create a conda or mamba environment + ```bash + conda create --name unsloth-blackwell python==3.12 -y + ``` + + Activate newly created environment + ```bash + conda activate unsloth-blackwell + ``` + +2) Install `vllm` + + Make sure you are inside the activated conda/mamba environment. You should see the name of your environment as a prefix to your terminal shell like this your `(unsloth-blackwell)user@machine:` + + ```bash + pip install -U vllm --extra-index-url https://download.pytorch.org/whl/cu128 --extra-index-url https://wheels.vllm.ai/nightly + ``` + + Note that we have to specify `cu128`, otherwise `vllm` will install `torch==2.7.0` but with `cu126`. + +3) Install `unsloth` dependencies + + Make sure you are inside the activated conda/mamba environment. You should see the name of your environment as a prefix to your terminal shell like this your `(unsloth-blackwell)user@machine:` + + ```bash + pip install unsloth unsloth_zoo bitsandbytes + ``` + +4) Download and build `xformers` + + Make sure you are inside the activated conda/mamba environment. You should see the name of your environment as a prefix to your terminal shell like this your `(unsloth-blackwell)user@machine:` + + ```bash + # First uninstall xformers installed by previous libraries + pip uninstall xformers + + # Clone and build + git clone --depth=1 https://github.com/facebookresearch/xformers --recursive + cd xformers + export TORCH_CUDA_ARCH_LIST="12.0" + python setup.py install + ``` + + Note that we have to explicitly set `TORCH_CUDA_ARCH_LIST=12.0`. + +5) Update `triton` + + Make sure you are inside the activated conda/mamba environment. You should see the name of your environment as a prefix to your terminal shell like this your `(unsloth-blackwell)user@machine:` + + ```bash + pip install -U triton>=3.3.1 + ``` + + `triton>=3.3.1` is required for `Blackwell` support. + +6) `Transformers` + `transformers >= 4.53.0` breaks `unsloth` inference. Specifically, `transformers` with `gradient_checkpointing` enabled will automatically [switch off caching](https://github.com/huggingface/transformers/blob/67ddc82fbc7e52c6f42a395b4a6d278c55b77a39/src/transformers/modeling_layers.py#L52-L59). + + When using `unsloth` `FastLanguageModel` to `generate` directly after training with `use_cache=True`, this will result in mismatch between expected and actual outputs [here](https://github.com/unslothai/unsloth/blob/bfa6a3678e2fb8097c5ece41d095a8051f099db3/unsloth/models/llama.py#L939). + + Temporary solution is to switch off `gradient_checkpointing` (e.g., `model.disable_gradient_checkpointing()`) before generation if using `4.53.0` or stick with `4.52.4` for now: + + Make sure you are inside the activated conda/mamba environment. You should see the name of your environment as a prefix to your terminal shell like this your `(unsloth-blackwell)user@machine:` + + ```bash + pip install -U transformers==4.52.4 + ``` + + +If you are using mamba as your package just replace conda with mamba for all commands shown above. + + +## Post Installation notes: + After installation, your environment should look similar to `blackwell.requirements.txt`. Note, might need to downgrade `numpy<=2.2` after all the installs. -### Test +## Test Both `test_llama32_sft.py` and `test_qwen3_grpo.py` should run without issue if correct install. If not, check diff between your installed env and `blackwell.requirements.txt`. From ba19fdaef926da4ade91a43f305e79fdbe195f43 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 30 Jun 2025 07:15:48 -0700 Subject: [PATCH 2/5] Gemma 3N bug fixes (#2842) * Update vision.py * Bug fix * Update mapper.py * check SDPA for Mistral 3, Pixtral * Update vision.py * Versioning * Update rl_replacements.py * Update README.md * add model registry * move hf hub utils to unsloth/utils * refactor global model info dicts to dataclasses * fix dataclass init * fix llama registration * remove deprecated key function * start registry reog * add llama vision * quant types -> Enum * remap literal quant types to QuantType Enum * add llama model registration * fix quant tag mapping * add qwen2.5 models to registry * add option to include original model in registry * handle quant types per model size * separate registration of base and instruct llama3.2 * add QwenQVQ to registry * add gemma3 to registry * add phi * add deepseek v3 * add deepseek r1 base * add deepseek r1 zero * add deepseek distill llama * add deepseek distill models * remove redundant code when constructing model names * add mistral small to registry * rename model registration methods * rename deepseek registration methods * refactor naming for mistral and phi * add global register models * refactor model registration tests for new registry apis * add model search method * remove deprecated registration api * add quant type test * add registry readme * make llama registration more specific * clear registry when executing individual model registration file * more registry readme updates * Update _auto_install.py * Llama4 * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Synthetic data * Update mapper.py * Xet and Synthetic * Update synthetic.py * Update loader.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update pyproject.toml * Delete .gitignore * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update _utils.py * Update pyproject.toml * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update synthetic.py * Update chat_templates.py * Seasame force float16 / float32 * Fix Seasame * Update loader.py * Update vision.py * Update vision.py * Update vision.py * Update loader.py * is_multimodal * Update loader.py * Update loader.py * Update loader.py * Update loader.py * Update vision.py * Update vision.py * Update vision.py * UNSLOTH_DISABLE_STATIC_GENERATION * Update vision.py * Auto vision detection * Sesame * Whisper * Update loader.py * Update loader.py * Update loader.py * Update mapper.py * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update loader.py * Update loader.py * Update loader.py * Update loader.py * Update _utils.py * Update rl.py * versioning * Update rl.py * Update rl.py * Update rl.py * Update rl.py * Update rl.py * logging * Update pyproject.toml * Update rl.py * versioning * Update rl.py * Update rl.py * Update rl_replacements.py * Update rl_replacements.py * Update rl.py * Update rl_replacements.py * Update rl_replacements.py * logits / temperature * Update rl_replacements.py * Update pyproject.toml * Update rl_replacements.py * Update rl_replacements.py * Debugging only * Update llama.py * Update llama.py * Update rl_replacements.py * Update rl_replacements.py * Update rl_replacements.py * Update rl_replacements.py * Update rl_replacements.py * Generic efficient GRPO * Update rl_replacements.py * Update rl_replacements.py * Remove debugging * Update rl_replacements.py * Update rl_replacements.py * Update vision.py * Update llama.py * Update rl_replacements.py * versioning * Update _utils.py * Update vision.py * Update mapper.py * Update loader.py * Update mapper.py * Update vision.py * Update loader.py * Update vision.py * Update loader.py * Update _utils.py * Update vision.py * gradient checkpointing * Gemma 3N fixes * Update loader.py * Versioning * Gemma 3N fixes * Update vision.py * Update vision.py * Update loader.py * Update vision.py --------- Co-authored-by: Jack Shi Wei Lun <87535974+jackswl@users.noreply.github.com> Co-authored-by: jeromeku Co-authored-by: Michael Han <107991372+shimmyshimmer@users.noreply.github.com> --- pyproject.toml | 4 ++-- unsloth/models/_utils.py | 2 +- unsloth/models/llama.py | 21 +++++++++++++------- unsloth/models/loader.py | 17 +++++++++++++++- unsloth/models/vision.py | 43 ++++++++++++++++++++++++++++++++++------ 5 files changed, 70 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a19d68f94a..e1e021d5ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ triton = [ ] huggingface = [ - "unsloth_zoo>=2025.6.6", + "unsloth_zoo>=2025.6.7", "packaging", "tyro", "transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3", @@ -381,7 +381,7 @@ colab-ampere-torch220 = [ "flash-attn>=2.6.3", ] colab-new = [ - "unsloth_zoo>=2025.6.6", + "unsloth_zoo>=2025.6.7", "packaging", "tyro", "transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3", diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index a31bf7b604..154b437525 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2025.6.8" +__version__ = "2025.6.9" __all__ = [ "SUPPORTS_BFLOAT16", diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py index bc46ba177b..d0ff413925 100644 --- a/unsloth/models/llama.py +++ b/unsloth/models/llama.py @@ -909,12 +909,7 @@ def LlamaModel_fast_forward( mask = self. GA_mask if use_static_mask else dynamic_GA_mask pass - try: - is_gradient_checkpointing_layer = isinstance(decoder_layer, GradientCheckpointingLayer) - except: - is_gradient_checkpointing_layer = False - - if gradient_checkpointing and not is_gradient_checkpointing_layer: + if gradient_checkpointing and not isinstance(decoder_layer, GradientCheckpointingLayer): def create_custom_forward(module): def custom_forward(*inputs): return module(*inputs, past_key_value, output_attentions, padding_mask = padding_mask, position_embeddings = position_embeddings) @@ -2019,7 +2014,7 @@ class FastLlamaModel: f" {chr(92)}{chr(92)} /| Num examples = {num_examples:,} | Num Epochs = {num_train_epochs:,} | Total steps = {max_steps:,}\\n"\\ f"O^O/ {chr(92)}_/ {chr(92)} Batch size per device = {self._train_batch_size:,} | Gradient accumulation steps = {args.gradient_accumulation_steps}\\n"\\ f"{chr(92)} / Data Parallel GPUs = {args.world_size} | Total batch size ({self._train_batch_size} x {args.gradient_accumulation_steps} x {args.world_size}) = {total_train_batch_size:,}\\n"\\ - f' "-____-" Trainable parameters = {get_model_param_count(model, trainable_only=True):,}/{get_model_param_count(model):,} ({get_model_param_count(model, trainable_only=True)/get_model_param_count(model)*100:.2f}% trained)' + f' "-____-" Trainable parameters = {get_model_param_count(model, trainable_only=True):,} of {get_model_param_count(model):,} ({get_model_param_count(model, trainable_only=True)/get_model_param_count(model)*100:.2f}% trained)' logger.warning(debug_info) import gc for _ in range(3): @@ -2842,6 +2837,12 @@ class FastLlamaModel: m = m.model _for_inference(m) + # Since transformers 4.53, must turn off explicitly + for module in model.modules(): + if hasattr(module, "gradient_checkpointing"): + module.gradient_checkpointing = False + pass + # Also disable training for embeddings for NEFTune if hasattr(model, "get_input_embeddings"): embeddings = model.get_input_embeddings() @@ -2880,6 +2881,12 @@ class FastLlamaModel: m = m.model _for_training(m) + # Since transformers 4.53, must turn on explicitly + for module in model.modules(): + if hasattr(module, "gradient_checkpointing"): + module.gradient_checkpointing = use_gradient_checkpointing + pass + # Also re-enable training for embeddings for NEFTune if hasattr(model, "get_input_embeddings"): embeddings = model.get_input_embeddings() diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index 70dd896514..a95a54b59d 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -547,25 +547,40 @@ class FastModel(FastBaseModel): lowered_model_name = model_name.lower() LATEST = '\nPlease use transformers via `pip install --no-deps git+https://github.com/huggingface/transformers.git`' NIGHTLY = '\nPlease use nightly transformers via pip install --upgrade "transformers>=4.49.0"`' + # Pixtral if "pixtral" in lowered_model_name and transformers_version < Version("4.49.0"): raise RuntimeError("Unsloth: Pixtral only works on transformers >= 4.49.0." + LATEST) + # Qwen 2.5 elif "qwen2.5" in lowered_model_name and transformers_version < Version("4.49.0"): raise RuntimeError("Unsloth: Qwen 2.5 only works on transformers >= 4.49.0." + LATEST) + # Gemma 3 elif "gemma-3" in lowered_model_name and transformers_version < Version("4.50.0.dev0"): raise RuntimeError("Unsloth: Gemma 3 only works on transformers >= 4.50.0." + NIGHTLY) + # Cohere elif "c4ai-command-a-03-2025" in lowered_model_name and transformers_version < Version("4.50.0.dev0"): raise RuntimeError("Unsloth: Cohere's Command model only works on transformers >= 4.50.0." + NIGHTLY) + # Sesame elif "csm-1b" in lowered_model_name: os.environ["UNSLOTH_DISABLE_STATIC_GENERATION"] = "1" # Sesame fails - os.environ["UNSLOTH_FORCE_CUSTOM_DTYPE"] = "torch.float16;if name.endswith(('_proj', 'fc1', 'fc2', 'codebook', 'head')): module.to(torch.float16)" + os.environ["UNSLOTH_FORCE_CUSTOM_DTYPE"] = \ + "all;torch.float32;torch.float16;"\ + "if name.endswith(('_proj', 'fc1', 'fc2', 'codebook', 'head')): module.to(torch.float16);" + # Granite 4 elif 'granite-4' in lowered_model_name: # granite-4 rms norms are stored as 16 bit, but we upcast os.environ["UNSLOTH_UPCAST_LAYERNORM"] = "1" os.environ["UNSLOTH_DISABLE_STATIC_GENERATION"] = "1" + # Olmo 2 elif "olmo-2" in lowered_model_name and transformers_version < Version("4.50.0.dev0"): raise RuntimeError("Unsloth: OLMo-2 only works on transformers >= 4.50.0." + NIGHTLY) + # Gemma 3N elif "gemma-3n" in lowered_model_name: os.environ["UNSLOTH_DISABLE_STATIC_GENERATION"] = "1" + os.environ["UNSLOTH_FORCE_CUSTOM_DTYPE"] = \ + "float16;torch.float16;torch.float16;"\ + "if name.endswith(('.conv')): module;"\ + "from unsloth_zoo.temporary_patches.gemma3n import patch_Gemma3nConvNormAct_forward; patch_Gemma3nConvNormAct_forward()" + if transformers_version < Version("4.53.0"): raise RuntimeError("Unsloth: Gemma 3N only works on transformers >= 4.53.0" + LATEST) else: diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py index 3137792dac..fb0a54489a 100644 --- a/unsloth/models/vision.py +++ b/unsloth/models/vision.py @@ -350,11 +350,23 @@ class FastBaseModel: correct_dtype = None if os.environ.get("UNSLOTH_FORCE_CUSTOM_DTYPE", "") != "": custom_datatype = os.environ["UNSLOTH_FORCE_CUSTOM_DTYPE"] - assert custom_datatype.count(";") == 1 - bnb_compute_dtype, custom_datatype = custom_datatype.split(";", 1) - dtype = torch.float32 - bnb_compute_dtype = eval(bnb_compute_dtype) - correct_dtype = bnb_compute_dtype + assert custom_datatype.count(";") >= 4 + checker, _dtype, _bnb_compute_dtype, _custom_datatype, execute_code = custom_datatype.split(";", 4) + + # Allow custom dtypes on all runs + allow_all_runs = (checker == "all") + # Allow only on float16 datatypes + allow_float16_runs = (checker == "float16" and dtype == torch.float16) + + if allow_all_runs or allow_float16_runs: + dtype = eval(_dtype) + bnb_compute_dtype = eval(_bnb_compute_dtype) + correct_dtype = bnb_compute_dtype + custom_datatype = _custom_datatype + # Execute code as well + if len(execute_code.strip()) != 0: + exec(execute_code) + pass pass # Stop SDPA for some archs like Pixtral / Mistral3 @@ -423,8 +435,15 @@ class FastBaseModel: # Edit data-types if custom_datatype is not None: - for name, module in model.named_modules(): + for jj, (name, module) in enumerate(model.named_modules()): exec(custom_datatype) + pass + # Clear deleted GPU items + for _ in range(3): + gc.collect() + if DEVICE_TYPE == "cuda": torch.cuda.empty_cache() + elif DEVICE_TYPE == "xpu": torch.xpu.empty_cache() + pass pass # Counteract saved tokenizers @@ -713,6 +732,12 @@ class FastBaseModel: m = m.model _for_inference(m) + # Since transformers 4.53, must turn off explicitly + for module in model.modules(): + if hasattr(module, "gradient_checkpointing"): + module.gradient_checkpointing = False + pass + # Also disable training for embeddings for NEFTune if hasattr(model, "get_input_embeddings"): embeddings = model.get_input_embeddings() @@ -755,6 +780,12 @@ class FastBaseModel: m = m.model _for_training(m) + # Since transformers 4.53, must turn on explicitly + for module in model.modules(): + if hasattr(module, "gradient_checkpointing"): + module.gradient_checkpointing = True + pass + # Also re-enable training for embeddings for NEFTune if hasattr(model, "get_input_embeddings"): embeddings = model.get_input_embeddings() From bbdf55b40d39c6a4db4b34387bfe6a2425d2bf8c Mon Sep 17 00:00:00 2001 From: DoubleMathew Date: Mon, 30 Jun 2025 18:38:51 -0500 Subject: [PATCH 3/5] Fix loftq None config for FastBaseModel (#2848) add new validate_loftq_config to __all__ --- unsloth/models/_utils.py | 61 ++++++++++++++++++++++++++++++++++++++++ unsloth/models/vision.py | 2 ++ 2 files changed, 63 insertions(+) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 154b437525..a71accd2f3 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -65,6 +65,7 @@ __all__ = [ "process_vision_info", "unsloth_compile_transformers", "patch_fast_lora", + "validate_loftq_config", ] import torch @@ -1307,3 +1308,63 @@ if USE_MODELSCOPE: raise ImportError(f'You are using the modelscope hub, please install modelscope by `pip install modelscope -U`') pass pass + + +def validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, model): + from peft import LoraConfig + + if loftq_config is None: loftq_config = {} + + signature = str(inspect.signature(LoraConfig)) + SUPPORTS_LOFTQ = "loftq_config" in signature + + if lora_dropout != 0: + logger.warning_once( + f"Unsloth: Dropout = 0 is supported for fast patching. You are using dropout = {lora_dropout}.\n"\ + f"Unsloth will patch all other layers, except LoRA matrices, causing a performance hit." + ) + pass + + if bias != "none": + logger.warning_once( + f"Unsloth: bias = `none` is supported for fast patching. You are using bias = {bias}.\n"\ + f"Unsloth will patch all other layers, except LoRA matrices, causing a performance hit." + ) + pass + + if not (type(init_lora_weights) is bool or \ + init_lora_weights == "gaussian" or init_lora_weights == "loftq"): + raise ValueError( + 'Unsloth: `init_lora_weights` must be either [True, False, "gaussian", "loftq"].' + ) + pass + + if init_lora_weights == "loftq": + + if not SUPPORTS_LOFTQ: + import peft + raise RuntimeError( + f"Unsloth: Your PEFT version of {peft.__version__} does not support LoftQ init.\n"\ + "Please install PEFT 0.7.2 or higher.\n"\ + "You can also install from source: `pip install git+https://github.com/huggingface/peft.git" + ) + pass + + if loftq_config == {}: + from peft import LoftQConfig + logger.warning_once( + "Unsloth: init_lora_weights = `loftq` is set, but `loftq_config` is None.\n"\ + "We shall use `loftq_config = LoftQConfig(loftq_bits = 4, loftq_iter = 1)`." + ) + loftq_config = LoftQConfig(loftq_bits = 4, loftq_iter = 1) + pass + + if hasattr(model.config, "quantization_config"): + raise ValueError( + "Unsloth: You are using `loftq` init, yet `load_in_4bit = True` was set.\n"\ + "Reload your model without any quantization by setting `load_in_4bit = False`." + ) + pass + pass + + return loftq_config \ No newline at end of file diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py index fb0a54489a..525e562abb 100644 --- a/unsloth/models/vision.py +++ b/unsloth/models/vision.py @@ -612,6 +612,8 @@ class FastBaseModel: torch.xpu.empty_cache() pass max_seq_length = model.max_seq_length + # if we pass loftq_config = None we will get an error + loftq_config = validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, model) lora_config = LoraConfig( r = r, lora_alpha = lora_alpha, From fc0c46bc8b091f9115a6108d7a916f2466f7f49d Mon Sep 17 00:00:00 2001 From: Rishabh Date: Mon, 30 Jun 2025 16:39:36 -0700 Subject: [PATCH 4/5] Convert torch.bfloat16, torch.float16, etc. to vLLM valid dtypes (#2811) * Convert torch.bfloat16, torch.float16, etc. to vLLM valid dtypes * removed newlines and extra whitespace --- unsloth/dataprep/synthetic.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/unsloth/dataprep/synthetic.py b/unsloth/dataprep/synthetic.py index de6aff560c..f3fbf77222 100644 --- a/unsloth/dataprep/synthetic.py +++ b/unsloth/dataprep/synthetic.py @@ -78,7 +78,17 @@ class SyntheticDataKit: use_bitsandbytes = False, **kwargs, ) - + if "dtype" in engine_args: + dtype_val = engine_args["dtype"] + # Convert torch.bfloat16, torch.float16, etc. to valid CLI string + if hasattr(dtype_val, "name"): + engine_args["dtype"] = dtype_val.name + elif isinstance(dtype_val, str) and dtype_val.startswith("torch."): + engine_args["dtype"] = dtype_val.split(".")[-1] + # Only allow valid vLLM choices + valid_dtypes = {"auto", "bfloat16", "float", "float16", "float32", "half"} + if engine_args["dtype"] not in valid_dtypes: + engine_args["dtype"] = "auto" if "device" in engine_args: del engine_args["device"] if "model" in engine_args: del engine_args["model"] if "compilation_config" in engine_args: From a9635c964e340173f7f5fd4191e4973600693ae5 Mon Sep 17 00:00:00 2001 From: billishyahao Date: Tue, 1 Jul 2025 07:52:05 +0800 Subject: [PATCH 5/5] [Feature] enable unsloth on amd gpu (#2520) * [Feature] enable unsloth on amd gpu * fix the comment --------- Co-authored-by: Daniel Han --- README.md | 39 +- pyproject.toml | 613 +--------------------------- requirements/build.txt | 7 + requirements/common.txt | 15 + requirements/cuda.txt | 7 + requirements/rocm.txt | 17 + setup.py | 844 +++++++++++++++++++++++++++++++++++++++ unsloth/models/_utils.py | 13 +- unsloth/version.py | 1 + use_existing_torch.py | 22 + 10 files changed, 970 insertions(+), 608 deletions(-) create mode 100644 requirements/build.txt create mode 100644 requirements/common.txt create mode 100644 requirements/cuda.txt create mode 100644 requirements/rocm.txt create mode 100644 setup.py create mode 100644 unsloth/version.py create mode 100644 use_existing_torch.py diff --git a/README.md b/README.md index 6279117888..bf7e879ace 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ For Windows install instructions, see [here](https://docs.unsloth.ai/get-started - All kernels written in [OpenAI's Triton](https://openai.com/index/triton/) language. **Manual backprop engine**. - **0% loss in accuracy** - no approximation methods - all exact. - No change of hardware. Supports NVIDIA GPUs since 2018+. Minimum CUDA Capability 7.0 (V100, T4, Titan V, RTX 20, 30, 40x, A100, H100, L40 etc) [Check your GPU!](https://developer.nvidia.com/cuda-gpus) GTX 1070, 1080 works, but is slow. +- AMD ROCm GPUs including Instinct 3xx series and Radeon GPUs are now supported! - Works on **Linux** and **Windows** - If you trained a model with 🦄Unsloth, you can use this cool sticker!   @@ -97,6 +98,42 @@ pip install unsloth pip install --upgrade --force-reinstall --no-cache-dir unsloth unsloth_zoo ``` See [here](https://github.com/unslothai/unsloth/edit/main/README.md#advanced-pip-installation) for advanced pip install instructions. + +### AMD ROCm GPU Installation + +**Launch container environment:** +``` +CONTAINER_NAME= +IMAGE_NAME=rocm/vllm:rocm6.4.1_vllm_0.9.0.1_20250605 + +docker run -it \ + --rm \ + --device /dev/dri \ + --device /dev/kfd \ + --network host \ + --ipc host \ + --group-add video \ + --cap-add SYS_PTRACE \ + --security-opt seccomp=unconfined \ + --privileged \ + --shm-size 32G \ + --name ${CONTAINER_NAME} \ + ${IMAGE_NAME} /bin/bash +``` + +**Install by setup.py install** +``` +# choose your rocm arch from INSTINCT_ARCH=("gfx942", "gfx90a"), or +# RADEON_ARCH=("gfx1100", "gfx1101", "gfx1102", "gfx1200", "gfx1201") +# Specify gfx942 here for MI300X device +ROCM_ARCH=gfx942 python setup.py bdist_wheel + +root@root:/workspace/unsloth# ls dist/ +unsloth-2025.6.5+rocm641-py3-none-any.whl + +pip install ./dist/unsloth-2025.6.5+rocm641-py3-none-any.whl +``` + ### Windows Installation > [!warning] > Python 3.13 does not support Unsloth. Use 3.12, 3.11 or 3.10 @@ -135,7 +172,7 @@ trainer = SFTTrainer( For **advanced installation instructions** or if you see weird errors during installations: -1. Install `torch` and `triton`. Go to https://pytorch.org to install it. For example `pip install torch torchvision torchaudio triton` +1. Install `torch` and `triton`. Go to https://pytorch.org to install it. For example `pip install torch torchvision torchaudio triton`. For AMD GPUs, please add `--extra-index-url https://download.pytorch.org/whl/rocm6.3` . For AMD support matrix info, please refer to https://rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html. 2. Confirm if CUDA is installed correctly. Try `nvcc`. If that fails, you need to install `cudatoolkit` or CUDA drivers. 3. Install `xformers` manually. You can try installing `vllm` and seeing if `vllm` succeeds. Check if `xformers` succeeded with `python -m xformers.info` Go to https://github.com/facebookresearch/xformers. Another option is to install `flash-attn` for Ampere GPUs. 4. Double check that your versions of Python, CUDA, CUDNN, `torch`, `triton`, and `xformers` are compatible with one another. The [PyTorch Compatibility Matrix](https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix) may be useful. diff --git a/pyproject.toml b/pyproject.toml index e1e021d5ed..fb066b8ed3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,24 @@ [build-system] -requires = ["setuptools", "setuptools-scm"] +# Should be mirrored in requirements/build.txt +requires = [ + "cmake>=3.26", + "ninja", + "packaging>=24.2", + "setuptools>=77.0.3,<80.0.0", + "setuptools-scm>=8.0", + "torch==2.7.0", + "wheel", + "jinja2" +] build-backend = "setuptools.build_meta" [project] name = "unsloth" -dynamic = ["version"] description = "2-5X faster LLM finetuning" readme = "README.md" requires-python = ">=3.9,<3.13" -license = {text = "Apache-2.0"} +dynamic = [ "version", "dependencies", "optional-dependencies"] +license = { file = "LICENSE" } keywords = ["ai", "llm",] authors = [ {email = "info@unsloth.ai"}, @@ -22,606 +32,15 @@ classifiers = [ "Programming Language :: Python", ] -[tool.setuptools.dynamic] -version = {attr = "unsloth.models._utils.__version__"} - [tool.setuptools] include-package-data = false + [tool.setuptools.packages.find] +where = ["."] +include = ["unsloth*"] exclude = ["images*", "tests*", "kernels/moe*"] -[project.optional-dependencies] -triton = [ - "triton-windows ; platform_system == 'Windows'", -] - -huggingface = [ - "unsloth_zoo>=2025.6.7", - "packaging", - "tyro", - "transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3", - "datasets>=3.4.1", - "sentencepiece>=0.2.0", - "tqdm", - "psutil", - "wheel>=0.42.0", - "numpy", - "accelerate>=0.34.1", - "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0", - "peft>=0.7.1,!=0.11.0", - "protobuf", - "huggingface_hub", - "hf_transfer", - "unsloth[triton]", -] -windows=[ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5 ; platform_system == 'Windows'", - "xformers>=0.0.22.post7 ; platform_system == 'Windows'", -] -cu118only = [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", -] -cu121only = [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", -] -cu118onlytorch211 = [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", -] -cu121onlytorch211 = [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", -] -cu118onlytorch212 = [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", -] -cu121onlytorch212 = [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", -] -cu118onlytorch220 = [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", -] -cu121onlytorch220 = [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", -] -cu118onlytorch230 = [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", -] -cu121onlytorch230 = [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", -] -cu118onlytorch240 = [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", -] -cu121onlytorch240 = [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", -] -cu124onlytorch240 = [ - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", -] -cu118onlytorch250 = [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", -] -cu121onlytorch250 = [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", -] -cu124onlytorch250 = [ - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", -] -cu118onlytorch251 = [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", -] -cu121onlytorch251 = [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", -] -cu124onlytorch251 = [ - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", -] -cu118onlytorch260 = [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", -] -cu124onlytorch260 = [ - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", -] -cu126onlytorch260 = [ - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", -] -cu126onlytorch270 = [ - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", -] -cu128onlytorch270 = [ - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", -] -cu118 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118only]", -] -cu121 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121only]", -] -cu118-torch211 = [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu118onlytorch211]", -] -cu121-torch211 = [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu121onlytorch211]", -] -cu118-torch212 = [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu118onlytorch212]", -] -cu121-torch212 = [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu121onlytorch212]", -] -cu118-torch220 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch220]", -] -cu121-torch220 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch220]", -] -cu118-torch230 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch230]", -] -cu121-torch230 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch230]", -] -cu118-torch240 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch240]", -] -cu121-torch240 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch240]", -] -cu124-torch240 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch240]", -] -cu118-torch250 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch250]", -] -cu121-torch250 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch250]", -] -cu124-torch250 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch250]", -] -cu118-torch251 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch251]", -] -cu121-torch251 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch251]", -] -cu124-torch251 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch251]", -] -cu118-torch260 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch260]", -] -cu124-torch260 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch260]", -] -cu126-torch260 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu126onlytorch260]", -] -cu126-torch270 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu126onlytorch270]", -] -cu128-torch270 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu128onlytorch270]", -] -kaggle = [ - "unsloth[huggingface]", -] -kaggle-new = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", -] -conda = [ - "unsloth[huggingface]", -] -colab-torch211 = [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu121onlytorch211]", -] -colab-ampere-torch211 = [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu121onlytorch211]", - "packaging", - "ninja", - "flash-attn>=2.6.3", -] -colab-torch220 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch220]", -] -colab-ampere-torch220 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch220]", - "packaging", - "ninja", - "flash-attn>=2.6.3", -] -colab-new = [ - "unsloth_zoo>=2025.6.7", - "packaging", - "tyro", - "transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3", - "datasets>=3.4.1", - "sentencepiece>=0.2.0", - "tqdm", - "psutil", - "wheel>=0.42.0", - "numpy", - "protobuf", - "huggingface_hub", - "hf_transfer", - "bitsandbytes>=0.45.5", - "unsloth[triton]", -] -colab-no-deps = [ - "accelerate>=0.34.1", - "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0", - "peft>=0.7.1", - "xformers", - "bitsandbytes>=0.45.5", - "protobuf", -] -colab = [ - "unsloth[cu121]", -] -flashattention = [ - "packaging ; platform_system == 'Linux'", - "ninja ; platform_system == 'Linux'", - "flash-attn>=2.6.3 ; platform_system == 'Linux'", -] -colab-ampere = [ - "unsloth[colab-ampere-torch220]", - "unsloth[flashattention]", -] -cu118-ampere = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118only]", - "unsloth[flashattention]", -] -cu121-ampere = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121only]", - "unsloth[flashattention]", -] -cu118-ampere-torch211 = [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu118onlytorch211]", - "unsloth[flashattention]", -] -cu121-ampere-torch211 = [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu121onlytorch211]", - "unsloth[flashattention]", -] -cu118-ampere-torch220 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch220]", - "unsloth[flashattention]", -] -cu121-ampere-torch220 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch220]", - "unsloth[flashattention]", -] -cu118-ampere-torch230 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch230]", - "unsloth[flashattention]", -] -cu121-ampere-torch230 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch230]", - "unsloth[flashattention]", -] -cu118-ampere-torch240 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch240]", - "unsloth[flashattention]", -] -cu121-ampere-torch240 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch240]", - "unsloth[flashattention]", -] -cu124-ampere-torch240 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch240]", - "unsloth[flashattention]", -] -cu118-ampere-torch250 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch250]", - "unsloth[flashattention]", -] -cu121-ampere-torch250 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch250]", - "unsloth[flashattention]", -] -cu124-ampere-torch250 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch250]", - "unsloth[flashattention]", -] -cu118-ampere-torch251 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch251]", - "unsloth[flashattention]", -] -cu121-ampere-torch251 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch251]", - "unsloth[flashattention]", -] -cu124-ampere-torch251 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch251]", - "unsloth[flashattention]", -] -cu118-ampere-torch260 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch260]", - "unsloth[flashattention]", -] -cu124-ampere-torch260 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch260]", - "unsloth[flashattention]", -] -cu126-ampere-torch260 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu126onlytorch260]", - "unsloth[flashattention]", -] -cu126-ampere-torch270 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu126onlytorch270]", - "unsloth[flashattention]", -] -cu128-ampere-torch270 = [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu128onlytorch270]", - "unsloth[flashattention]", -] - -flashattentiontorch260abiFALSEcu12x = [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", -] -flashattentiontorch260abiTRUEcu12x = [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", -] -flashattentiontorch250abiFALSEcu12x = [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", -] -flashattentiontorch250abiTRUEcu12x = [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", -] -flashattentiontorch240abiFALSEcu12x = [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", -] -flashattentiontorch240abiTRUEcu12x = [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", -] -intel-gpu-torch260 = [ - "unsloth[huggingface]", - - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp39-cp39-linux_x86_64.whl#sha256=147607f190a7d7aa24ba454def5977fbbfec792fdae18e4ed278cfec29b69271 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp310-cp310-linux_x86_64.whl#sha256=23aa423fa1542afc34f67eb3ba8ef20060f6d1b3a4697eaeab22b11c92b30f2b ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp311-cp311-linux_x86_64.whl#sha256=bcfa995229bbfd9ffd8d6c8d9f6428d393e876fa6e23ee3c20e3c0d73ca75ca5 ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp312-cp312-linux_x86_64.whl#sha256=bd340903d03470708df3442438acb8b7e08087ab9e61fbe349b2872bf9257ab0 ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp313-cp313-linux_x86_64.whl#sha256=814dccc8a07159e6eca74bed70091bc8fea2d9dd87b0d91845f9f38cde62f01c ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", - - "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp39-cp39-linux_x86_64.whl#sha256=6a8adf6dc4c089406e8b3a7e58ab57a463bddf9b07130d2576e76eced43e92af ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp310-cp310-linux_x86_64.whl#sha256=ff4561cbf07c83bbccaa0f6e9bb0e6dcf721bacd53c9c43c4eb0e7331b4792f9 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp311-cp311-linux_x86_64.whl#sha256=12005f66b810ddd3ab93f86c4522bcfdd412cbd27fc9d189b661ff7509bc5e8a ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp312-cp312-linux_x86_64.whl#sha256=c4c5c67625cdacf35765c2b94e61fe166e3c3f4a14521b1212a59ad1b3eb0f2e ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp313-cp313-linux_x86_64.whl#sha256=e6864f7a60a5ecc43d5d38f59a16e5dd132384f73dfd3a697f74944026038f7b ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", -] -intel-gpu-torch270 = [ - "unsloth[huggingface]", - - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=749a7098492c6a27b356c97149a4a62973b953eae60bc1b6259260974f344913 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=44362e80abd752471a08341093321955b066daa2cfb4810e73b8e3b240850f93 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=faa6b8c945a837a080f641bc8ccc77a98fa66980dcd7e62e715fd853737343fd ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=40f6fb65b345dc9a61813abe7ac9a585f2c9808f414d140cc2a5f11f53ee063c ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=9821fe059de58e827ffc6aa10d69369b16c2f8c2a988b86bef9c2c6e396ab3aa ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", - - "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp39-cp39-linux_x86_64.whl#sha256=f8ee75e50fcbb37ed5b498299ca2264da99ab278a93fae2358e921e4a6e28273 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp310-cp310-linux_x86_64.whl#sha256=d6fdc342961d98fdcd9d03dfd491a3208bb5f7fbb435841f8f72ce9fdcd2d026 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp311-cp311-linux_x86_64.whl#sha256=74d07f9357df5cf2bf223ad3c84de16346bfaa0504f988fdd5590d3e177e5e86 ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp312-cp312-linux_x86_64.whl#sha256=c806d44aa2ca5d225629f6fbc6c994d5deaac2d2cde449195bc8e3522ddd219a ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp313-cp313-linux_x86_64.whl#sha256=25d8277b7f01d42e2e014ccbab57a2692b6ec4eff8dcf894eda1b297407cf97a ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", -] [project.urls] homepage = "http://www.unsloth.ai" diff --git a/requirements/build.txt b/requirements/build.txt new file mode 100644 index 0000000000..1943dde2f9 --- /dev/null +++ b/requirements/build.txt @@ -0,0 +1,7 @@ +cmake>=3.26 +ninja +packaging>=24.2 +setuptools>=77.0.3,<80.0.0 +setuptools-scm>=8.0 +wheel +jinja2 \ No newline at end of file diff --git a/requirements/common.txt b/requirements/common.txt new file mode 100644 index 0000000000..61c547d7d1 --- /dev/null +++ b/requirements/common.txt @@ -0,0 +1,15 @@ +unsloth_zoo>=2025.6.2 +packaging +tyro +transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2 +datasets>=3.4.1 +sentencepiece>=0.2.0 +tqdm +psutil +wheel>=0.42.0 +numpy +accelerate>=0.34.1 +trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0 +peft>=0.7.1,!=0.11.0 +huggingface_hub +hf_transfer diff --git a/requirements/cuda.txt b/requirements/cuda.txt new file mode 100644 index 0000000000..8028f64124 --- /dev/null +++ b/requirements/cuda.txt @@ -0,0 +1,7 @@ +# Common dependencies +-r common.txt + +torch +torchaudio +torchvision +xformers diff --git a/requirements/rocm.txt b/requirements/rocm.txt new file mode 100644 index 0000000000..10dde5052c --- /dev/null +++ b/requirements/rocm.txt @@ -0,0 +1,17 @@ +# Common dependencies +-r common.txt + +--extra-index-url https://download.pytorch.org/whl/rocm6.3 + +torch==2.7.0 +torchvision==0.21.0 +torchaudio==2.7.0 + +triton==3.2 +cmake>=3.26,<4 +packaging +setuptools>=77.0.3,<80.0.0 +setuptools-scm>=8 +wheel +jinja2>=3.1.6 +amdsmi==6.4.1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000..0f4a86330e --- /dev/null +++ b/setup.py @@ -0,0 +1,844 @@ +# Copid and modified based on https://github.com/vllm-project/vllm/blob/main/setup.py +# SPDX-License-Identifier: Apache-2.0 + +import ctypes +import importlib.util +import json +import logging +import os +import re +import subprocess +import sys +from pathlib import Path +from shutil import which +import shutil + +import torch +from packaging.version import Version, parse +from setuptools import Extension, setup +from setuptools.command.build_ext import build_ext +from setuptools_scm import get_version +from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME + +from setuptools.command.install import install + +# This arg is for multi-device +UNSLOTH_TARGET_DEVICE = os.environ.get('UNSLOTH_TARGET_DEVICE', 'cuda') + + +def load_module_from_path(module_name, path): + spec = importlib.util.spec_from_file_location(module_name, path) + module = importlib.util.module_from_spec(spec) + sys.modules[module_name] = module + spec.loader.exec_module(module) + return module + +ROOT_DIR = Path(__file__).parent + + +# cannot import version directly because it depends on unsloth, +# which is not installed yet +ver = load_module_from_path('ver', os.path.join(ROOT_DIR, 'unsloth', 'version.py')) + +def _is_cuda() -> bool: + has_cuda = torch.version.cuda is not None + return UNSLOTH_TARGET_DEVICE == "cuda" and has_cuda + + +def _is_hip() -> bool: + return (UNSLOTH_TARGET_DEVICE == "cuda" + or UNSLOTH_TARGET_DEVICE == "rocm") and torch.version.hip is not None + + +def get_nvcc_cuda_version() -> Version: + """Get the CUDA version from nvcc. + + Adapted from https://github.com/NVIDIA/apex/blob/8b7a1ff183741dd8f9b87e7bafd04cfde99cea28/setup.py + """ + assert CUDA_HOME is not None, "CUDA_HOME is not set" + nvcc_output = subprocess.check_output([CUDA_HOME + "/bin/nvcc", "-V"], + universal_newlines=True) + output = nvcc_output.split() + release_idx = output.index("release") + 1 + nvcc_cuda_version = parse(output[release_idx].split(",")[0]) + return nvcc_cuda_version + + +def get_rocm_version(): + # Get the Rocm version from the ROCM_HOME/bin/librocm-core.so + # see https://github.com/ROCm/rocm-core/blob/d11f5c20d500f729c393680a01fa902ebf92094b/rocm_version.cpp#L21 + try: + librocm_core_file = Path(ROCM_HOME) / "lib" / "librocm-core.so" + if not librocm_core_file.is_file(): + return None + librocm_core = ctypes.CDLL(librocm_core_file) + VerErrors = ctypes.c_uint32 + get_rocm_core_version = librocm_core.getROCmVersion + get_rocm_core_version.restype = VerErrors + get_rocm_core_version.argtypes = [ + ctypes.POINTER(ctypes.c_uint32), + ctypes.POINTER(ctypes.c_uint32), + ctypes.POINTER(ctypes.c_uint32), + ] + major = ctypes.c_uint32() + minor = ctypes.c_uint32() + patch = ctypes.c_uint32() + + if (get_rocm_core_version(ctypes.byref(major), ctypes.byref(minor), + ctypes.byref(patch)) == 0): + return f"{major.value}.{minor.value}.{patch.value}" + return None + except Exception: + return None + + +def get_unsloth_version() -> str: + version = ver.__version__ + + if version is None: + raise RuntimeError("unsloth version not found") + + sep = "+" if "+" not in version else "." # dev versions might contain + + + if _is_cuda(): + cuda_version = str(get_nvcc_cuda_version()) + cuda_version_str = cuda_version.replace(".", "")[:3] + # skip this for source tarball, required for pypi + if "sdist" not in sys.argv: + version += f"{sep}cu{cuda_version_str}" + elif _is_hip(): + # Get the Rocm Version + rocm_version = get_rocm_version() or torch.version.hip + if rocm_version: + version += f"{sep}rocm{rocm_version.replace('.', '')[:3]}" + else: + raise RuntimeError("Unknown runtime environment") + + return version + +def get_requirements() -> list[str]: + """Get Python package dependencies from requirements.txt.""" + requirements_dir = ROOT_DIR / "requirements" + + def _read_requirements(filename: str) -> list[str]: + with open(requirements_dir / filename) as f: + requirements = f.read().strip().split("\n") + resolved_requirements = [] + for line in requirements: + if line.startswith("-r "): + resolved_requirements += _read_requirements(line.split()[1]) + elif not line.startswith("--") and not line.startswith( + "#") and line.strip() != "": + resolved_requirements.append(line) + return resolved_requirements + + if _is_cuda(): + requirements = _read_requirements("cuda.txt") + elif _is_hip(): + requirements = _read_requirements("rocm.txt") + else: + requirements = _read_requirements("common.txt") + raise ValueError( + "Unsupported platform, please use CUDA, ROCm, " + ) + + return requirements + + +INSTINCT_ARCH=("gfx942", "gfx90a") +RADEON_ARCH=("gfx1100", "gfx1101", "gfx1102", "gfx1200", "gfx1201") + + +class RocmExtraInstallCommand(install): + def run(self): + + if os.path.exists('thirdparties'): + shutil.rmtree('thirdparties') + + os.mkdir('thirdparties') + os.chdir('thirdparties') + + # Extract ROCm GPU arch from environment variable. If unset, then detect ROCm arch from rocminfo + # Refer to https://github.com/bitsandbytes-foundation/bitsandbytes/blob/1abd5e781013a085f86586b30a248dc769909668/bitsandbytes/cuda_specs.py#L81 + # TODO(billishyahao): need to triage rocminfo unavailable observation from https://github.com/bitsandbytes-foundation/bitsandbytes/issues/1444 + rocm_arch = os.environ.get('ROCM_ARCH', None) + if rocm_arch is None: + try: + result = subprocess.run(["rocminfo"], capture_output=True, text=True) + match = re.search(r"Name:\s+gfx([a-zA-Z\d]+)", result.stdout) + if match: + rocm_arch = f"gfx{match.group(1)}" + print(f"Automatically detected ROCm GPU architecture: {rocm_arch}") + else: + print("Skipping ROCm extra install, cannot detect ROCm arch automatically...") + install.run(self) + return + except Exception as e: + print("Could not detect ROCm GPU architecture: {e}") + if torch.cuda.is_available(): + print("ROCm GPU architecture detection failed despite ROCm being available...") + install.run(self) + return + + # flash-attention + # MI3xx has both CK backend and Triton backend. + import importlib + if importlib.util.find_spec("flash_attn") is None: + print("Installing flash-attention...") + if rocm_arch in INSTINCT_ARCH: + subprocess.check_call(['git', 'clone', '--recursive', 'https://github.com/ROCm/flash-attention.git']) + os.chdir('flash-attention') + num_jobs = os.cpu_count() - 1 + subprocess.check_call(['pip', 'install', '-v', '.', f'MAX_JOBS={num_jobs}'], shell=True) + os.chdir('..') + # Only Triton backend supports Radeon GPUs + elif rocm_arch in RADEON_ARCH: + subprocess.check_call(['git', 'clone', '--recursive', 'https://github.com/ROCm/flash-attention.git']) + os.chdir('flash-attention') + subprocess.check_call(['git', 'checkout', 'main_perf']) + subprocess.check_call(['FLASH_ATTENTION_TRITON_AMD_ENABLE="TRUE"', 'python', 'setup.py', 'install', ], shell=True) + os.chdir('..') + + # Comment out the following if you need xformers installed. + # # only install xformers in Instinct GPUs + # if importlib.util.find_spec("xformers") is None: + # print("Installing xformers...") + # if rocm_arch in INSTINCT_ARCH: + # subprocess.check_call(['git', 'clone', 'https://github.com/ROCm/xformers.git']) + # os.chdir('xformers') + # subprocess.check_call(['git', 'submodule', 'update', '--init', '--recursive']) + # os.environ['PYTORCH_ROCM_ARCH'] = rocm_arch + # subprocess.check_call(['python', 'setup.py', 'install']) + # os.chdir('..') + + # bitsandbytes + if importlib.util.find_spec("bitsandbytes") is None: + print("Installing bitsandbytes...") + subprocess.check_call(['git', 'clone', '--recurse-submodules', 'https://github.com/ROCm/bitsandbytes']) + os.chdir('bitsandbytes') + subprocess.check_call(['git', 'checkout', 'rocm_enabled_multi_backend']) + subprocess.check_call(['pip', 'install', '-r', 'requirements-dev.txt']) + subprocess.check_call(['cmake', '-DCOMPUTE_BACKEND=hip', '-S', '.']) # Add -DBNB_ROCM_ARCH if needed + subprocess.check_call(['make']) + subprocess.check_call(['pip', 'install', '.']) + os.chdir('..') + + os.chdir('..') + + # Continue with regular install + install.run(self) + +package_data = { + "unsloth": [ + "py.typed", + ] +} + +extras_require = { + "triton" : [ + "triton-windows ; platform_system == 'Windows'", + ], + + "huggingface" : [ + "unsloth_zoo>=2025.6.6", + "packaging", + "tyro", + "transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3", + "datasets>=3.4.1", + "sentencepiece>=0.2.0", + "tqdm", + "psutil", + "wheel>=0.42.0", + "numpy", + "accelerate>=0.34.1", + "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0", + "peft>=0.7.1,!=0.11.0", + "protobuf", + "huggingface_hub", + "hf_transfer", + "unsloth[triton]", + ], + "windows" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5 ; platform_system == 'Windows'", + "xformers>=0.0.22.post7 ; platform_system == 'Windows'", + ], + "cu118only" : [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + ], + "cu121only" : [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + ], + "cu118onlytorch211" : [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + ], + "cu121onlytorch211" : [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + ], + "cu118onlytorch212" : [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + ], + "cu121onlytorch212" : [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + ], + "cu118onlytorch220" : [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + ], + "cu121onlytorch220" : [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + ], + "cu118onlytorch230" : [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + ], + "cu121onlytorch230" : [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + ], + "cu118onlytorch240" : [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + ], + "cu121onlytorch240" : [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + ], + "cu124onlytorch240" : [ + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", + ], + "cu118onlytorch250" : [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + ], + "cu121onlytorch250" : [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + ], + "cu124onlytorch250" : [ + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", + ], + "cu118onlytorch251" : [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + ], + "cu121onlytorch251" : [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + ], + "cu124onlytorch251" : [ + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", + ], + "cu118onlytorch260" : [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + ], + "cu124onlytorch260" : [ + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", + ], + "cu126onlytorch260" : [ + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", + ], + "cu126onlytorch270" : [ + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", + ], + "cu128onlytorch270" : [ + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", + ], + "cu118" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118only]", + ], + "cu121" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121only]", + ], + "cu118-torch211" : [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu118onlytorch211]", + ], + "cu121-torch211" : [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu121onlytorch211]", + ], + "cu118-torch212" : [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu118onlytorch212]", + ], + "cu121-torch212" : [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu121onlytorch212]", + ], + "cu118-torch220" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch220]", + ], + "cu121-torch220" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch220]", + ], + "cu118-torch230" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch230]", + ], + "cu121-torch230" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch230]", + ], + "cu118-torch240" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch240]", + ], + "cu121-torch240" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch240]", + ], + "cu124-torch240" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch240]", + ], + "cu118-torch250" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch250]", + ], + "cu121-torch250" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch250]", + ], + "cu124-torch250" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch250]", + ], + "cu118-torch251" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch251]", + ], + "cu121-torch251" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch251]", + ], + "cu124-torch251" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch251]", + ], + "cu118-torch260" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch260]", + ], + "cu124-torch260" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch260]", + ], + "cu126-torch260" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu126onlytorch260]", + ], + "cu126-torch270" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu126onlytorch270]", + ], + "cu128-torch270" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu128onlytorch270]", + ], + "kaggle" : [ + "unsloth[huggingface]", + ], + "kaggle-new" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + ], + "conda" : [ + "unsloth[huggingface]", + ], + "colab-torch211" : [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu121onlytorch211]", + ], + "colab-ampere-torch211" : [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu121onlytorch211]", + "packaging", + "ninja", + "flash-attn>=2.6.3", + ], + "colab-torch220" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch220]", + ], + "colab-ampere-torch220" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch220]", + "packaging", + "ninja", + "flash-attn>=2.6.3", + ], + "colab-new" : [ + "unsloth_zoo>=2025.6.6", + "packaging", + "tyro", + "transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3", + "datasets>=3.4.1", + "sentencepiece>=0.2.0", + "tqdm", + "psutil", + "wheel>=0.42.0", + "numpy", + "protobuf", + "huggingface_hub", + "hf_transfer", + "bitsandbytes>=0.45.5", + "unsloth[triton]", + ], + "colab-no-deps" : [ + "accelerate>=0.34.1", + "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0", + "peft>=0.7.1", + "xformers", + "bitsandbytes>=0.45.5", + "protobuf", + ], + "colab" : [ + "unsloth[cu121]", + ], + "flashattention" : [ + "packaging ; platform_system == 'Linux'", + "ninja ; platform_system == 'Linux'", + "flash-attn>=2.6.3 ; platform_system == 'Linux'", + ], + "colab-ampere" : [ + "unsloth[colab-ampere-torch220]", + "unsloth[flashattention]", + ], + "cu118-ampere" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118only]", + "unsloth[flashattention]", + ], + "cu121-ampere" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121only]", + "unsloth[flashattention]", + ], + "cu118-ampere-torch211" : [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu118onlytorch211]", + "unsloth[flashattention]", + ], + "cu121-ampere-torch211" : [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu121onlytorch211]", + "unsloth[flashattention]", + ], + "cu118-ampere-torch220" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch220]", + "unsloth[flashattention]", + ], + "cu121-ampere-torch220" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch220]", + "unsloth[flashattention]", + ], + "cu118-ampere-torch230" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch230]", + "unsloth[flashattention]", + ], + "cu121-ampere-torch230" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch230]", + "unsloth[flashattention]", + ], + "cu118-ampere-torch240" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch240]", + "unsloth[flashattention]", + ], + "cu121-ampere-torch240" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch240]", + "unsloth[flashattention]", + ], + "cu124-ampere-torch240" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch240]", + "unsloth[flashattention]", + ], + "cu118-ampere-torch250" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch250]", + "unsloth[flashattention]", + ], + "cu121-ampere-torch250" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch250]", + "unsloth[flashattention]", + ], + "cu124-ampere-torch250" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch250]", + "unsloth[flashattention]", + ], + "cu118-ampere-torch251" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch251]", + "unsloth[flashattention]", + ], + "cu121-ampere-torch251" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch251]", + "unsloth[flashattention]", + ], + "cu124-ampere-torch251" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch251]", + "unsloth[flashattention]", + ], + "cu118-ampere-torch260" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch260]", + "unsloth[flashattention]", + ], + "cu124-ampere-torch260" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch260]", + "unsloth[flashattention]", + ], + "cu126-ampere-torch260" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu126onlytorch260]", + "unsloth[flashattention]", + ], + "cu126-ampere-torch270" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu126onlytorch270]", + "unsloth[flashattention]", + ], + "cu128-ampere-torch270" : [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu128onlytorch270]", + "unsloth[flashattention]", + ], + + "flashattentiontorch260abiFALSEcu12x" : [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", + ], + "flashattentiontorch260abiTRUEcu12x" : [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", + ], + "flashattentiontorch250abiFALSEcu12x" : [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", + ], + "flashattentiontorch250abiTRUEcu12x" : [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", + ], + "flashattentiontorch240abiFALSEcu12x" : [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", + ], + "flashattentiontorch240abiTRUEcu12x" : [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", + ], + "intel-gpu-torch260" : [ + "unsloth[huggingface]", + + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp39-cp39-linux_x86_64.whl#sha256=147607f190a7d7aa24ba454def5977fbbfec792fdae18e4ed278cfec29b69271 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp310-cp310-linux_x86_64.whl#sha256=23aa423fa1542afc34f67eb3ba8ef20060f6d1b3a4697eaeab22b11c92b30f2b ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp311-cp311-linux_x86_64.whl#sha256=bcfa995229bbfd9ffd8d6c8d9f6428d393e876fa6e23ee3c20e3c0d73ca75ca5 ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp312-cp312-linux_x86_64.whl#sha256=bd340903d03470708df3442438acb8b7e08087ab9e61fbe349b2872bf9257ab0 ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp313-cp313-linux_x86_64.whl#sha256=814dccc8a07159e6eca74bed70091bc8fea2d9dd87b0d91845f9f38cde62f01c ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", + + "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp39-cp39-linux_x86_64.whl#sha256=6a8adf6dc4c089406e8b3a7e58ab57a463bddf9b07130d2576e76eced43e92af ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp310-cp310-linux_x86_64.whl#sha256=ff4561cbf07c83bbccaa0f6e9bb0e6dcf721bacd53c9c43c4eb0e7331b4792f9 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp311-cp311-linux_x86_64.whl#sha256=12005f66b810ddd3ab93f86c4522bcfdd412cbd27fc9d189b661ff7509bc5e8a ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp312-cp312-linux_x86_64.whl#sha256=c4c5c67625cdacf35765c2b94e61fe166e3c3f4a14521b1212a59ad1b3eb0f2e ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp313-cp313-linux_x86_64.whl#sha256=e6864f7a60a5ecc43d5d38f59a16e5dd132384f73dfd3a697f74944026038f7b ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", + ], + "intel-gpu-torch270" : [ + "unsloth[huggingface]", + + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=749a7098492c6a27b356c97149a4a62973b953eae60bc1b6259260974f344913 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=44362e80abd752471a08341093321955b066daa2cfb4810e73b8e3b240850f93 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=faa6b8c945a837a080f641bc8ccc77a98fa66980dcd7e62e715fd853737343fd ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=40f6fb65b345dc9a61813abe7ac9a585f2c9808f414d140cc2a5f11f53ee063c ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=9821fe059de58e827ffc6aa10d69369b16c2f8c2a988b86bef9c2c6e396ab3aa ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", + + "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp39-cp39-linux_x86_64.whl#sha256=f8ee75e50fcbb37ed5b498299ca2264da99ab278a93fae2358e921e4a6e28273 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp310-cp310-linux_x86_64.whl#sha256=d6fdc342961d98fdcd9d03dfd491a3208bb5f7fbb435841f8f72ce9fdcd2d026 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp311-cp311-linux_x86_64.whl#sha256=74d07f9357df5cf2bf223ad3c84de16346bfaa0504f988fdd5590d3e177e5e86 ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp312-cp312-linux_x86_64.whl#sha256=c806d44aa2ca5d225629f6fbc6c994d5deaac2d2cde449195bc8e3522ddd219a ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp313-cp313-linux_x86_64.whl#sha256=25d8277b7f01d42e2e014ccbab57a2692b6ec4eff8dcf894eda1b297407cf97a ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", + ] +} + +cmdclass = {} + +if _is_hip(): + cmdclass = { + 'install': RocmExtraInstallCommand + } + +setup( + # static metadata should rather go in pyproject.toml + version=get_unsloth_version(), + install_requires=get_requirements(), + extras_require=extras_require, + cmdclass=cmdclass, + package_data=package_data, +) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index a71accd2f3..5016e1be3a 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2025.6.9" +from unsloth.version import __version__ __all__ = [ "SUPPORTS_BFLOAT16", @@ -1312,26 +1312,22 @@ pass def validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, model): from peft import LoraConfig - if loftq_config is None: loftq_config = {} signature = str(inspect.signature(LoraConfig)) SUPPORTS_LOFTQ = "loftq_config" in signature - if lora_dropout != 0: logger.warning_once( f"Unsloth: Dropout = 0 is supported for fast patching. You are using dropout = {lora_dropout}.\n"\ f"Unsloth will patch all other layers, except LoRA matrices, causing a performance hit." ) pass - if bias != "none": logger.warning_once( f"Unsloth: bias = `none` is supported for fast patching. You are using bias = {bias}.\n"\ f"Unsloth will patch all other layers, except LoRA matrices, causing a performance hit." ) pass - if not (type(init_lora_weights) is bool or \ init_lora_weights == "gaussian" or init_lora_weights == "loftq"): raise ValueError( @@ -1340,7 +1336,6 @@ def validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, m pass if init_lora_weights == "loftq": - if not SUPPORTS_LOFTQ: import peft raise RuntimeError( @@ -1349,7 +1344,6 @@ def validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, m "You can also install from source: `pip install git+https://github.com/huggingface/peft.git" ) pass - if loftq_config == {}: from peft import LoftQConfig logger.warning_once( @@ -1358,7 +1352,6 @@ def validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, m ) loftq_config = LoftQConfig(loftq_bits = 4, loftq_iter = 1) pass - if hasattr(model.config, "quantization_config"): raise ValueError( "Unsloth: You are using `loftq` init, yet `load_in_4bit = True` was set.\n"\ @@ -1366,5 +1359,5 @@ def validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, m ) pass pass - - return loftq_config \ No newline at end of file + return loftq_config +pass diff --git a/unsloth/version.py b/unsloth/version.py new file mode 100644 index 0000000000..9878268554 --- /dev/null +++ b/unsloth/version.py @@ -0,0 +1 @@ +__version__ = "2025.6.8" \ No newline at end of file diff --git a/use_existing_torch.py b/use_existing_torch.py new file mode 100644 index 0000000000..0f1fe66e91 --- /dev/null +++ b/use_existing_torch.py @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project and Unsloth project +# Copying from https://github.com/vllm-project/vllm/blob/main/use_existing_torch.py + +import glob + +requires_files = glob.glob('requirements/*.txt') +requires_files += ["pyproject.toml"] +for file in requires_files: + print(f">>> cleaning {file}") + with open(file) as f: + lines = f.readlines() + if "torch" in "".join(lines).lower(): + print("removed:") + with open(file, 'w') as f: + for line in lines: + if 'torch' not in line.lower(): + f.write(line) + else: + print(line.strip()) + print(f"<<< done cleaning {file}") + print()