Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Point five mapper rows at their upstream repo instead of an unpublished unsloth 16bit name (#12587)
Leo Borcherding5ae9c3b55dcf
diff --git a/tests/test_unpublished_16bit_mapping.py b/tests/test_unpublished_16bit_mapping.pynew file mode 100644index 00000000000..914a1e83931--- /dev/null+++ b/tests/test_unpublished_16bit_mapping.py@@ -0,0 +1,73 @@+# Unsloth Zoo - Utilities for Unsloth+# Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.+#+# This program is free software: you can redistribute it and/or modify+# it under the terms of the GNU Affero General Public License as published+# by the Free Software Foundation, either version 3 of the License, or+# (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU Affero General Public License for more details.+#+# You should have received a copy of the GNU Affero General Public License+# along with this program. If not, see <https://www.gnu.org/licenses/>.++"""16bit loads and merges take a row's first name, so it must not be an unpublished ``unsloth/`` repo."""++import os++import pytest++MAPPER_PATH = os.path.join(os.path.dirname(__file__), os.pardir, "unsloth", "models", "mapper.py")++# key -> (unpublished name, upstream)+ROWS = {+ "unsloth/mistral-7b-instruct-v0.1-bnb-4bit": (+ "unsloth/mistral-7b-instruct-v0.1",+ "mistralai/Mistral-7B-Instruct-v0.1",+ ),+ "unsloth/Hermes-3-Llama-3.1-70B-bnb-4bit": (+ "unsloth/Hermes-3-Llama-3.1-70B",+ "NousResearch/Hermes-3-Llama-3.1-70B",+ ),+ "unsloth/Qwen2-VL-72B-bnb-4bit": (+ "unsloth/Qwen2-VL-72B",+ "Qwen/Qwen2-VL-72B",+ ),+ "unsloth/Llama-3.1-Tulu-3-70B-bnb-4bit": (+ "unsloth/Llama-3.1-Tulu-3-70B",+ "allenai/Llama-3.1-Tulu-3-70B",+ ),+ "unsloth/OpenThinker-7B-unsloth-bnb-4bit": (+ "unsloth/OpenThinker-7B",+ "open-thoughts/OpenThinker-7B",+ ),+}+++def _load_mappers():+ with open(MAPPER_PATH, encoding = "utf-8") as f:+ source = f.read()+ namespace = {}+ exec(compile(source, MAPPER_PATH, "exec"), namespace)+ return namespace++[email protected]("key", sorted(ROWS))+def test_row_resolves_16bit_to_upstream(key):+ namespace = _load_mappers()+ unpublished, upstream = ROWS[key]++ assert namespace["INT_TO_FLOAT_MAPPER"][key] == upstream+ assert namespace["INT_TO_FLOAT_MAPPER"][key.lower()] == upstream+ assert upstream.lower() not in namespace["MAP_TO_UNSLOTH_16bit"]+ assert namespace["FLOAT_TO_INT_MAPPER"][upstream] == key+++def test_unpublished_names_are_gone():+ with open(MAPPER_PATH, encoding = "utf-8") as f:+ source = f.read()+ for unpublished, _ in ROWS.values():+ assert f'"{unpublished}",' not in source, unpublisheddiff --git a/unsloth/models/mapper.py b/unsloth/models/mapper.pyindex 4210e754230..6fb21f389e3 100644--- a/unsloth/models/mapper.py+++ b/unsloth/models/mapper.py@@ -80,7 +80,6 @@ __INT_TO_FLOAT_MAPPER = \"TinyLlama/TinyLlama-1.1B-Chat-v1.0",),"unsloth/mistral-7b-instruct-v0.1-bnb-4bit" : (- "unsloth/mistral-7b-instruct-v0.1","mistralai/Mistral-7B-Instruct-v0.1",),"unsloth/mistral-7b-instruct-v0.2-bnb-4bit" : (@@ -335,7 +334,6 @@ __INT_TO_FLOAT_MAPPER = \"NousResearch/Hermes-3-Llama-3.1-8B",),"unsloth/Hermes-3-Llama-3.1-70B-bnb-4bit" : (- "unsloth/Hermes-3-Llama-3.1-70B","NousResearch/Hermes-3-Llama-3.1-70B",),"unsloth/Hermes-3-Llama-3.1-405B-bnb-4bit" : (@@ -568,7 +566,6 @@ __INT_TO_FLOAT_MAPPER = \"Qwen/Qwen2-VL-7B",),"unsloth/Qwen2-VL-72B-bnb-4bit" : (- "unsloth/Qwen2-VL-72B","Qwen/Qwen2-VL-72B",),"unsloth/Llama-3.2-11B-Vision-Instruct-unsloth-bnb-4bit" : (@@ -611,7 +608,6 @@ __INT_TO_FLOAT_MAPPER = \"allenai/Llama-3.1-Tulu-3-8B",),"unsloth/Llama-3.1-Tulu-3-70B-bnb-4bit" : (- "unsloth/Llama-3.1-Tulu-3-70B","allenai/Llama-3.1-Tulu-3-70B",),"unsloth/QwQ-32B-Preview-bnb-4bit" : (@@ -699,7 +695,6 @@ __INT_TO_FLOAT_MAPPER = \"unsloth/DeepScaleR-1.5B-Preview-bnb-4bit",),"unsloth/OpenThinker-7B-unsloth-bnb-4bit" : (- "unsloth/OpenThinker-7B","open-thoughts/OpenThinker-7B","unsloth/OpenThinker-7B-bnb-4bit",),