From 681b10dc0c4620b3acac90b69aba9c3eb3f68716 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 11 Jul 2025 00:01:37 -0700 Subject: [PATCH] Fixes --- README.md | 2 +- unsloth/models/llama.py | 27 ++++++++++++--------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 4b5f0cb480..1cb5fe9bee 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Notebooks are beginner friendly. Read our [guide](https://docs.unsloth.ai/get-st | **Mistral v0.3 (7B)** | [▶️ Start for free](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Mistral_v0.3_(7B)-Conversational.ipynb) | 2.2x faster | 75% less | | **Orpheus-TTS (3B)** | [▶️ Start for free](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Orpheus_(3B)-TTS.ipynb) | 1.5x faster | 50% less | -- See all our notebooks for: [Kaggle](https://github.com/unslothai/notebooks?tab=readme-ov-file#-kaggle-notebooks), [GRPO](https://docs.unsloth.ai/get-started/unsloth-notebooks), **[TTS](https://docs.unsloth.ai/get-started/unsloth-notebooks#text-to-speech-tts-notebooks)** & [Vision](https://docs.unsloth.ai/get-started/unsloth-notebooks#vision-multimodal-notebooks) +- See all our notebooks for: [Kaggle](https://github.com/unslothai/notebooks?tab=readme-ov-file#-kaggle-notebooks), [GRPO](https://docs.unsloth.ai/get-started/unsloth-notebooks#grpo-reasoning-rl-notebooks), **[TTS](https://docs.unsloth.ai/get-started/unsloth-notebooks#text-to-speech-tts-notebooks)** & [Vision](https://docs.unsloth.ai/get-started/unsloth-notebooks#vision-multimodal-notebooks) - See [all our models](https://docs.unsloth.ai/get-started/all-our-models) and [all our notebooks](https://github.com/unslothai/notebooks) - See detailed documentation for Unsloth [here](https://docs.unsloth.ai/) diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py index 8ccdeba353..0bbe867879 100644 --- a/unsloth/models/llama.py +++ b/unsloth/models/llama.py @@ -2540,11 +2540,8 @@ class FastLlamaModel: raise NotImplementedError("Unsloth: Currently fast inference does not work with using biases for LoRA.") pass - #does not get lora yet, so get name from model, not base model - - is_classification = "Classification" in str(type(model)) - # Get LoRA - # + #d oes not get lora yet, so get name from model, not base model + is_classification = "Classification" in str(type(model)) arguments = dict( r = r, @@ -2696,16 +2693,16 @@ class FastLlamaModel: # Get activation function model_type = model.config.model_type - if model_type == "llama": apply_lora_mlp = apply_lora_mlp_swiglu - elif model_type == "mistral": apply_lora_mlp = apply_lora_mlp_swiglu - elif model_type == "qwen2": apply_lora_mlp = apply_lora_mlp_swiglu - elif model_type == "gemma": apply_lora_mlp = apply_lora_mlp_geglu_approx - elif model_type == "gemma2": apply_lora_mlp = apply_lora_mlp_geglu_approx - elif model_type == "cohere": apply_lora_mlp = apply_lora_mlp_swiglu - elif model_type == "granite": apply_lora_mlp = apply_lora_mlp_swiglu - elif model_type == "qwen3": apply_lora_mlp = apply_lora_mlp_swiglu - elif model_type == "falcon_h1": apply_lora_mlp = apply_lora_mlp_swiglu - elif model_type == "qwen3moe": apply_lora_mlp = apply_lora_mlp_swiglu + if model_type == "llama": apply_lora_mlp = apply_lora_mlp_swiglu + elif model_type == "mistral": apply_lora_mlp = apply_lora_mlp_swiglu + elif model_type == "qwen2": apply_lora_mlp = apply_lora_mlp_swiglu + elif model_type == "gemma": apply_lora_mlp = apply_lora_mlp_geglu_approx + elif model_type == "gemma2": apply_lora_mlp = apply_lora_mlp_geglu_approx + elif model_type == "cohere": apply_lora_mlp = apply_lora_mlp_swiglu + elif model_type == "granite": apply_lora_mlp = apply_lora_mlp_swiglu + elif model_type == "qwen3": apply_lora_mlp = apply_lora_mlp_swiglu + elif model_type == "falcon_h1": apply_lora_mlp = apply_lora_mlp_swiglu + elif model_type == "qwen3moe": apply_lora_mlp = apply_lora_mlp_swiglu else: raise NotImplementedError(f"Unsloth: {model_type} is not yet implemented!") pass