From 1729c7e1412d406a6d4e8b65786fb14a09165bbd Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sat, 17 May 2025 05:11:50 -0700 Subject: [PATCH 1/7] Fix Whisper, ModernBERT (#2565) * Update vision.py * Update vision.py * Update mapper.py * Update vision.py * fix: config.torch_dtype in LlamaModel_fast_forward_inference (#2091) * fix: config.torch_dtype in LlamaModel_fast_forward_inference * Update llama.py * update for consistency --------- Co-authored-by: Daniel Han * versioning * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update vision.py * model_type_arch * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update loader.py * check * Update _utils.py * Update loader.py * Update loader.py * Remove prints * Update README.md typo * Update _utils.py * Update _utils.py * versioning * Update _utils.py * Update _utils.py * Update _utils.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update llama.py * Update vision.py * HF Transfer * fix(utils): add missing importlib import to fix NameError (#2134) This commit fixes a NameError that occurs when `importlib` is referenced in _utils.py without being imported, especially when UNSLOTH_USE_MODELSCOPE=1 is enabled. By adding the missing import statement, the code will no longer throw a NameError. * Add QLoRA Train and Merge16bit Test (#2130) * add reference and unsloth lora merging tests * add test / dataset printing to test scripts * allow running tests from repo root * add qlora test readme * more readme edits * ruff formatting * additional readme comments * forgot to add actual tests * add apache license * Update pyproject.toml * Update vision.py * Update vision.py * Update vision.py * Update vision.py * Update loader.py * Update loader.py * Revert * Update vision.py * Update vision.py * Update vision.py * Update vision.py * 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 --------- Co-authored-by: lurf21 <93976703+lurf21@users.noreply.github.com> Co-authored-by: Jack Shi Wei Lun <87535974+jackswl@users.noreply.github.com> Co-authored-by: naliazheli Co-authored-by: jeromeku Co-authored-by: Michael Han <107991372+shimmyshimmer@users.noreply.github.com> --- unsloth/models/_utils.py | 2 +- unsloth/models/loader.py | 44 ++++++++++++++++++++++++---------------- unsloth/models/mapper.py | 32 ++++++++++++++++++++--------- unsloth/models/vision.py | 17 +++++++++++++--- 4 files changed, 63 insertions(+), 32 deletions(-) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 63f48af659..747858d011 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.5.5" +__version__ = "2025.5.6" __all__ = [ "SUPPORTS_BFLOAT16", diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index 9c5a7b68be..8a49026984 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -461,6 +461,12 @@ except: from transformers import AutoModelForVision2Seq pass +DISABLE_COMPILE_MODEL_NAMES = [ + "aya-vision", + "modernbert", + "granite-vision", +] + class FastModel(FastBaseModel): @staticmethod @@ -521,33 +527,35 @@ class FastModel(FastBaseModel): model_name = get_model_name(model_name, load_in_4bit) # Check versions + 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"`' - if "pixtral" in model_name.lower() and transformers_version < Version("4.49.0"): + 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) - elif "qwen2.5" in model_name.lower() and transformers_version < Version("4.49.0"): + 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) - elif "aya-vision" in model_name.lower(): - # Disable compiling for now - errors out! - os.environ["UNSLOTH_COMPILE_DISABLE"] = "1" - if transformers_version < Version("4.50.0.dev0"): - raise RuntimeError("Unsloth: Aya Vision only works on transformers >= 4.50.0." + NIGHTLY) - elif "gemma-3" in model_name.lower() and transformers_version < Version("4.50.0.dev0"): + 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) - elif "c4ai-command-a-03-2025" in model_name.lower() and transformers_version < Version("4.50.0.dev0"): + 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) - elif "granite-vision" in model_name.lower(): - # Disable compiling for now - errors out! - os.environ["UNSLOTH_COMPILE_DISABLE"] = "1" - if transformers_version < Version("4.50.0.dev0"): - raise RuntimeError("Unsloth: Granite Vision only works on transformers >= 4.50.0." + NIGHTLY) - elif "csm-1b" in model_name.lower(): + 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)" - elif "olmo-2" in model_name.lower() and transformers_version < Version("4.50.0.dev0"): + 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) - elif "whisper" in model_name.lower(): - os.environ["UNSLOTH_DISABLE_STATIC_GENERATION"] = "1" # Whisper fails + else: + for check_model_name in DISABLE_COMPILE_MODEL_NAMES: + if check_model_name in lowered_model_name: + os.environ["UNSLOTH_COMPILE_DISABLE"] = "1" + os.environ["UNSLOTH_DISABLE_STATIC_GENERATION"] = "1" + if transformers_version < Version("4.50.0.dev0"): + raise RuntimeError(f"Unsloth: {check_model_name} only works on transformers >= 4.50.0." + NIGHTLY) + break + pass + + if auto_model is not None: + # All other models need to disable static cache + os.environ["UNSLOTH_DISABLE_STATIC_GENERATION"] = "1" pass if USE_MODELSCOPE and not os.path.exists(model_name): diff --git a/unsloth/models/mapper.py b/unsloth/models/mapper.py index 4bbd8295cc..e50a5a877d 100644 --- a/unsloth/models/mapper.py +++ b/unsloth/models/mapper.py @@ -728,16 +728,6 @@ __INT_TO_FLOAT_MAPPER = \ "mistralai/Mistral-Small-3.1-24B-Base-2503", "unsloth/Mistral-Small-3.1-24B-Base-2503-bnb-4bit", ), - "unsloth/orpheus-3b-0.1-pretrained-unsloth-bnb-4bit" : ( - "unsloth/orpheus-3b-0.1-pretrained", - "canopylabs/orpheus-3b-0.1-pretrained", - "unsloth/orpheus-3b-0.1-pretrained-bnb-4bit", - ), - "unsloth/orpheus-3b-0.1-ft-unsloth-bnb-4bit" : ( - "unsloth/orpheus-3b-0.1-ft", - "canopylabs/orpheus-3b-0.1-ft", - "unsloth/orpheus-3b-0.1-ft-bnb-4bit", - ), "unsloth/Qwen3-0.6B-unsloth-bnb-4bit" : ( "unsloth/Qwen3-0.6B", "Qwen/Qwen3-0.6B", @@ -817,6 +807,16 @@ __INT_TO_FLOAT_MAPPER = \ "microsoft/Phi-4-mini-reasoning", "unsloth/phi-4-mini-reasoning-bnb-4bit", ), + "unsloth/orpheus-3b-0.1-pretrained-unsloth-bnb-4bit" : ( + "unsloth/orpheus-3b-0.1-pretrained", + "canopylabs/orpheus-3b-0.1-pretrained", + "unsloth/orpheus-3b-0.1-pretrained-bnb-4bit", + ), + "unsloth/orpheus-3b-0.1-ft-unsloth-bnb-4bit" : ( + "unsloth/orpheus-3b-0.1-ft", + "canopylabs/orpheus-3b-0.1-ft", + "unsloth/orpheus-3b-0.1-ft-bnb-4bit", + ), "unsloth/csm-1b" : ( "unsloth/csm-1b", "sesame/csm-1b", @@ -837,6 +837,18 @@ __INT_TO_FLOAT_MAPPER = \ "unsloth/CrisperWhisper", "nyrahealth/CrisperWhisper", ), + "unsloth/Llasa-1B" : ( + "unsloth/Llasa-1B", + "HKUSTAudio/Llasa-1B", + ), + "unsloth/Spark-TTS-0.5B" : ( + "unsloth/Spark-TTS-0.5B", + "SparkAudio/Spark-TTS-0.5B", + ), + "unsloth/Llama-OuteTTS-1.0-1B" : ( + "unsloth/Llama-OuteTTS-1.0-1B", + "OuteAI/Llama-OuteTTS-1.0-1B", + ), } INT_TO_FLOAT_MAPPER = {} diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py index 2bff87d8d9..4466128a28 100644 --- a/unsloth/models/vision.py +++ b/unsloth/models/vision.py @@ -95,8 +95,18 @@ def unsloth_base_fast_generate( input_ids = kwargs["input_ids"] elif "input" in kwargs: input_ids = kwargs["input_ids"] + elif "input_features" in kwargs: + input_ids = kwargs["input_features"] + elif "input_embeds" in kwargs: + input_ids = kwargs["input_embeds"] + elif "inputs" in kwargs: + input_ids = kwargs["inputs"] else: - raise TypeError("Unsloth: You need to pass in input_ids to .generate!") + key = next(iter(kwargs.keys())) + if type(kwargs["key"]) is not torch.Tensor: + raise TypeError("Unsloth: You need to pass in input_ids to .generate!") + input_ids = kwargs[key] + pass assert(type(input_ids) is torch.Tensor) bsz = input_ids.shape[0] @@ -203,10 +213,11 @@ def unsloth_base_fast_generate( if "generation_config" in kwargs: kwargs["generation_config"].cache_implementation = cache_implementation - kwargs["generation_config"].compile_config = _compile_config if cache_implementation is not None else None + if cache_implementation is not None: + kwargs["generation_config"].compile_config = _compile_config else: kwargs["cache_implementation"] = cache_implementation - if cache_implementation: + if cache_implementation is not None: kwargs["compile_config"] = _compile_config pass From 17bbb4106ea6de8ac91fabc2085f78b9db795722 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sat, 17 May 2025 05:42:10 -0700 Subject: [PATCH 2/7] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 41 ----------------------- .github/ISSUE_TEMPLATE/documentation.md | 34 ------------------- .github/ISSUE_TEMPLATE/feature_request.md | 36 +++++++++++++++----- .github/ISSUE_TEMPLATE/question.md | 10 ------ .github/ISSUE_TEMPLATE/❓-other.md | 10 ++++++ .github/ISSUE_TEMPLATE/🐛-bug.md | 21 ++++++++++++ 6 files changed, 59 insertions(+), 93 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/documentation.md delete mode 100644 .github/ISSUE_TEMPLATE/question.md create mode 100644 .github/ISSUE_TEMPLATE/❓-other.md create mode 100644 .github/ISSUE_TEMPLATE/🐛-bug.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 4c6ab77d83..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -name: 🐛 Bug report -about: Create a report to help us improve -title: "[Bug]" -labels: bug -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. Please fill out the following sections and provide a minimal reproduction script so that we can provide a solution as quickly as possible! - -1. **Environment Setup:** - - OS: [e.g., Ubuntu 20.04] - - Python Version: [e.g., 3.8.10] - - Frameworks/Libraries: please paste output of `pip freeze` here - - `colab` / script - was this run in `colab` or as a script? - -2. **Dataset Details:** - - Dataset Name: - - Data Preprocessing Steps: [e.g., tokenization, formatting funcs, data collators, etc.] - -3. **Model Details:** - - Model ID: - - Model Configuration: [e.g., lora params, quantization, etc.] - -4. **Training Configuration:** - - Trainer Args: `SFTConfig`, `GRPOConfig` - -5. **Reproduction Steps:** - - Minimal script to reproduce error - - If using a `colab`, please provide the link to the notebook and describe any changes made. - -6. **Expected Behavior:** - -7. **Actual Behavior:** - - [e.g., Description of the error, unexpected results, or performance issues encountered] - - [e.g., Error messages or logs] - -8. **Additional notes:** - - Any additional information that might help us reproduce the bug. diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md deleted file mode 100644 index 19af72486e..0000000000 --- a/.github/ISSUE_TEMPLATE/documentation.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -name: 📚 Documentation -about: Report incorrect or needed docs for https://docs.unsloth.ai/ -title: "[Docs]" -labels: documentation -assignees: '' - ---- - -- [ ] Report incorrect documentation -- [ ] Report needed documentation - -## Report incorrect documentation - -**Location of incorrect documentation -- provide links and line numbers if possible.** - -**Describe the problems or issues found in the documentation** - -**Steps taken to verify documentation is incorrect** - -**Suggested fix** - ---- - -## Report needed documentation - -**What's missing?** - - -**Describe the documentation you'd like -- how can we make using `unsloth` easier?** - - -**Help us understand how we can make finding the needed info easier!** -List any steps you have taken, e.g. searching the repo, reading the docs, etc. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 7f7d93c0f6..9da73b2583 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,14 +1,34 @@ --- -name: 🚀 Feature request -about: "Suggest an idea: new model, algorithm or feature etc." +name: "\U0001F680 Feature request" +about: New features, model support, ideas title: "[Feature]" -labels: "feature request" +labels: feature request assignees: '' --- -**What features would you like to see? Is it related to a problem or a new feature you'd like to see? Please describe.** -What we can do to improve `unsloth`? - -**Additional context** -Feel free to add any other context, links, or screenshots here. +1. For new models, have you tried: +```python +from unsloth import FastModel +model, tokenizer = FastModel.from_pretrained( + "microsoft/Phi-4-multimodal-instruct", + trust_remote_code = True, +) +``` +If that doesn't work, try using the exact `AutoModel` class: +```python +from transformers import WhisperForConditionalGeneration +model, tokenizer = FastModel.from_pretrained( + model_name = "unsloth/whisper-large-v3", + auto_model = WhisperForConditionalGeneration, +) +``` +For Sequence Classification / other `AutoModel` classes: +```python +from transformers import AutoModelForSequenceClassification +model, tokenizer = FastModel.from_pretrained( + model_name = "unsloth/whisper-large-v3", + auto_model = AutoModelForSequenceClassification, +) +``` +2. Otherwise, ask away! diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 90aa1284d7..0000000000 --- a/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: ❓ Submit question -about: Ask a general question about unsloth -title: "[Question]" -labels: "question" -assignees: '' - ---- - -**What is your question?** diff --git a/.github/ISSUE_TEMPLATE/❓-other.md b/.github/ISSUE_TEMPLATE/❓-other.md new file mode 100644 index 0000000000..dbec522eed --- /dev/null +++ b/.github/ISSUE_TEMPLATE/❓-other.md @@ -0,0 +1,10 @@ +--- +name: "❓ Other" +about: Other +title: "[Question]" +labels: '' +assignees: '' + +--- + +Be specific. If you need urgent help, head to https://discord.com/invite/unsloth for help. Have you tried https://docs.unsloth.ai/basics/errors-troubleshooting or https://github.com/unslothai/unsloth/wiki ? diff --git a/.github/ISSUE_TEMPLATE/🐛-bug.md b/.github/ISSUE_TEMPLATE/🐛-bug.md new file mode 100644 index 0000000000..6e59ccbdd4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/🐛-bug.md @@ -0,0 +1,21 @@ +--- +name: "\U0001F41B Bug" +about: For bugs +title: "[Bug]" +labels: bug +assignees: '' + +--- + +1. **Environment** + - `Colab`, `Kaggle`, local / cloud machine + - Number GPUs used, GPU type, VRAM amount + - Copy paste Unsloth printout with sloth emoji + - Which notebook are you using? + +2. **Code to reproduce** + - Which trainer - `SFTTrainer, GRPOTrainer` etc + - Exact code to repro. **Remove Hugging Face token!** + - Expected behavior + +For quick replies, head to https://discord.com/invite/unsloth and ask away! have you tried https://github.com/unslothai/unsloth/wiki or https://docs.unsloth.ai/basics/errors-troubleshooting? From 2fdfbb09f4bc6cebe2e5ae77a5cc7640af173e98 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sat, 17 May 2025 18:29:27 -0700 Subject: [PATCH 3/7] Update issue templates --- .github/ISSUE_TEMPLATE/bug---issue.md | 19 +++++++++++++ .github/ISSUE_TEMPLATE/feature-request.md | 21 ++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 34 ----------------------- .github/ISSUE_TEMPLATE/other.md | 10 +++++++ .github/ISSUE_TEMPLATE/❓-other.md | 10 ------- .github/ISSUE_TEMPLATE/🐛-bug.md | 21 -------------- 6 files changed, 50 insertions(+), 65 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug---issue.md create mode 100644 .github/ISSUE_TEMPLATE/feature-request.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/other.md delete mode 100644 .github/ISSUE_TEMPLATE/❓-other.md delete mode 100644 .github/ISSUE_TEMPLATE/🐛-bug.md diff --git a/.github/ISSUE_TEMPLATE/bug---issue.md b/.github/ISSUE_TEMPLATE/bug---issue.md new file mode 100644 index 0000000000..a08a6cf2cf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug---issue.md @@ -0,0 +1,19 @@ +--- +name: Bug / Issue +about: Bug / Issue +title: "[Bug]" +labels: bug +assignees: '' + +--- + +1. Did you update? `pip install --upgrade unsloth unsloth_zoo` +2. `Colab` or `Kaggle` or local / cloud +3. Number GPUs used, use `nvidia-smi` +4. Which notebook? +5. Paste `Unsloth` printout with :sloth: sloth emoji +6. Which trainer? `SFTTrainer`, `GRPOTrainer` etc +7. **Minimal code to reproduce error Remove Hugging Face token!** + +For quick replies, got to https://discord.com/invite/unsloth. +Have you tried https://docs.unsloth.ai/basics/errors-troubleshooting diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000000..5ea70a8a03 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,21 @@ +--- +name: Feature Request +about: New features, model support, ideas +title: "[Feature]" +labels: feature request +assignees: '' + +--- + +For new models, have you tried: +```python +from unsloth import FastModel +model, tokenizer = FastModel.from_pretrained( + "microsoft/Phi-4-multimodal-instruct", + trust_remote_code = True, +) +from transformers import AutoModelForSequenceClassification +model, tokenizer = FastModel.from_pretrained( + auto_model = AutoModelForSequenceClassification, +) +``` diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 9da73b2583..0000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -name: "\U0001F680 Feature request" -about: New features, model support, ideas -title: "[Feature]" -labels: feature request -assignees: '' - ---- - -1. For new models, have you tried: -```python -from unsloth import FastModel -model, tokenizer = FastModel.from_pretrained( - "microsoft/Phi-4-multimodal-instruct", - trust_remote_code = True, -) -``` -If that doesn't work, try using the exact `AutoModel` class: -```python -from transformers import WhisperForConditionalGeneration -model, tokenizer = FastModel.from_pretrained( - model_name = "unsloth/whisper-large-v3", - auto_model = WhisperForConditionalGeneration, -) -``` -For Sequence Classification / other `AutoModel` classes: -```python -from transformers import AutoModelForSequenceClassification -model, tokenizer = FastModel.from_pretrained( - model_name = "unsloth/whisper-large-v3", - auto_model = AutoModelForSequenceClassification, -) -``` -2. Otherwise, ask away! diff --git a/.github/ISSUE_TEMPLATE/other.md b/.github/ISSUE_TEMPLATE/other.md new file mode 100644 index 0000000000..b78d201062 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other.md @@ -0,0 +1,10 @@ +--- +name: Other +about: Everything else +title: '' +labels: '' +assignees: '' + +--- + +Try asking https://discord.com/invite/unsloth for fast support! diff --git a/.github/ISSUE_TEMPLATE/❓-other.md b/.github/ISSUE_TEMPLATE/❓-other.md deleted file mode 100644 index dbec522eed..0000000000 --- a/.github/ISSUE_TEMPLATE/❓-other.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: "❓ Other" -about: Other -title: "[Question]" -labels: '' -assignees: '' - ---- - -Be specific. If you need urgent help, head to https://discord.com/invite/unsloth for help. Have you tried https://docs.unsloth.ai/basics/errors-troubleshooting or https://github.com/unslothai/unsloth/wiki ? diff --git a/.github/ISSUE_TEMPLATE/🐛-bug.md b/.github/ISSUE_TEMPLATE/🐛-bug.md deleted file mode 100644 index 6e59ccbdd4..0000000000 --- a/.github/ISSUE_TEMPLATE/🐛-bug.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: "\U0001F41B Bug" -about: For bugs -title: "[Bug]" -labels: bug -assignees: '' - ---- - -1. **Environment** - - `Colab`, `Kaggle`, local / cloud machine - - Number GPUs used, GPU type, VRAM amount - - Copy paste Unsloth printout with sloth emoji - - Which notebook are you using? - -2. **Code to reproduce** - - Which trainer - `SFTTrainer, GRPOTrainer` etc - - Exact code to repro. **Remove Hugging Face token!** - - Expected behavior - -For quick replies, head to https://discord.com/invite/unsloth and ask away! have you tried https://github.com/unslothai/unsloth/wiki or https://docs.unsloth.ai/basics/errors-troubleshooting? From 7b579571819e956ea457c1ceee73fadce5223979 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sat, 17 May 2025 18:30:17 -0700 Subject: [PATCH 4/7] Update issue templates --- .github/ISSUE_TEMPLATE/other.md | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/other.md diff --git a/.github/ISSUE_TEMPLATE/other.md b/.github/ISSUE_TEMPLATE/other.md deleted file mode 100644 index b78d201062..0000000000 --- a/.github/ISSUE_TEMPLATE/other.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Other -about: Everything else -title: '' -labels: '' -assignees: '' - ---- - -Try asking https://discord.com/invite/unsloth for fast support! From ce45ec2b7479e1886b9c13339a8ac4a78c558d63 Mon Sep 17 00:00:00 2001 From: Michael Han <107991372+shimmyshimmer@users.noreply.github.com> Date: Mon, 19 May 2025 21:26:19 -0700 Subject: [PATCH 5/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 74c5e8afac..e053c2d8f3 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Notebooks are beginner friendly. Read our [guide](https://docs.unsloth.ai/get-st | **Llama 3.2 Vision (11B)** | [▶️ Start for free](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.2_(11B)-Vision.ipynb) | 2x faster | 50% less | | **Llama 3.1 (8B)** | [▶️ Start for free](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.1_(8B)-Alpaca.ipynb) | 2x faster | 70% less | | **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 | -| **Sesame-CSM (1B)** | [▶️ Start for free](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Orpheus_(3B)-TTS.ipynb) | 1.5x faster | 50% less | +| **Sesame-CSM (1B)** | [▶️ Start for free](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Sesame_CSM_(1B)-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#grpo-reasoning-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 our [Synthetic Dataset notebook](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Meta_Synthetic_Data_Llama3_2_%283B%29.ipynb) in collaboration with Meta From a4bb68027e55aa4bd3daf4b9ff30206cfa8871c1 Mon Sep 17 00:00:00 2001 From: Michael Han <107991372+shimmyshimmer@users.noreply.github.com> Date: Tue, 20 May 2025 09:51:55 -0700 Subject: [PATCH 6/7] Update README.md Updating model support --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e053c2d8f3..95492b6ef3 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ For Windows install instructions, see [here](https://docs.unsloth.ai/get-started ## ⭐ Key Features - Supports **full-finetuning**, pretraining, 4b-bit, 16-bit and **8-bit** training +- Supports **all transformer-style models** including [TTS, STT](https://docs.unsloth.ai/basics/text-to-speech-tts-fine-tuning), multimodal, diffusion, [BERT](https://docs.unsloth.ai/get-started/unsloth-notebooks#other-important-notebooks) and more! - 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. From 911a1def95cdbdfafee230d8a2e759a7714f914d Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Wed, 21 May 2025 07:35:36 -0700 Subject: [PATCH 7/7] Devstral, MedGemma --- pyproject.toml | 4 ++-- unsloth/models/_utils.py | 2 +- unsloth/models/mapper.py | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 558abd9f1a..7fb572b735 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ triton = [ ] huggingface = [ - "unsloth_zoo>=2025.5.7", + "unsloth_zoo>=2025.5.8", "packaging", "tyro", "transformers==4.51.3,!=4.47.0", @@ -381,7 +381,7 @@ colab-ampere-torch220 = [ "flash-attn>=2.6.3", ] colab-new = [ - "unsloth_zoo>=2025.5.7", + "unsloth_zoo>=2025.5.8", "packaging", "tyro", "transformers==4.51.3,!=4.47.0", diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 747858d011..964e874c58 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.5.6" +__version__ = "2025.5.7" __all__ = [ "SUPPORTS_BFLOAT16", diff --git a/unsloth/models/mapper.py b/unsloth/models/mapper.py index e50a5a877d..50f0f7d7fb 100644 --- a/unsloth/models/mapper.py +++ b/unsloth/models/mapper.py @@ -849,6 +849,21 @@ __INT_TO_FLOAT_MAPPER = \ "unsloth/Llama-OuteTTS-1.0-1B", "OuteAI/Llama-OuteTTS-1.0-1B", ), + "unsloth/medgemma-4b-it-unsloth-bnb-4bit" : ( + "unsloth/medgemma-4b-it", + "google/medgemma-4b-it", + "unsloth/medgemma-4b-it-bnb-4bit", + ), + "unsloth/medgemma-27b-text-it-unsloth-bnb-4bit" : ( + "unsloth/medgemma-27b-text-it", + "google/medgemma-27b-text-it", + "unsloth/medgemma-27b-text-it-bnb-4bit", + ), + "unsloth/Devstral-Small-2505-unsloth-bnb-4bit" : ( + "unsloth/Devstral-Small-2505", + "mistralai/Devstral-Small-2505", + "unsloth/Devstral-Small-2505-bnb-4bit", + ), } INT_TO_FLOAT_MAPPER = {}