* Rebuild Studio branch on top of main * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix security and code quality issues for Studio PR #4237 - Validate models_dir query param against allowed directory roots to prevent path traversal in /api/models/local endpoint - Replace string startswith() with Path.is_relative_to() for frontend path traversal check in serve_frontend - Sanitize SSE error messages to not leak exception details to clients (4 locations in inference.py) - Bind port-discovery socket to 127.0.0.1 instead of all interfaces in llama_cpp backend - Import datasets_root and resolve_output_dir in embedding training function to fix NameError and use managed output directory - Remove stale .gitignore entries for package-lock.json and test directories so tests can be tracked in version control - Add venv-reexecution logic to ui CLI command matching the studio command behavior * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Move models_dir path validation before try/except block The HTTPException(403) was inside the try/except Exception handler, so it would be caught and re-raised as a 500. Moving the validation before the try block ensures the 403 is returned directly and also makes the control flow clearer for static analysis (path is validated before any filesystem operations). * Use os.path.realpath + startswith for models_dir validation CodeQL py/path-injection does not recognize Path.is_relative_to() as a sanitizer. Switched to os.path.realpath + str.startswith which is a recognized sanitizer pattern in CodeQL's taint analysis. The startswith check uses root_str + os.sep to prevent prefix collisions (e.g. /app/models_evil matching /app/models). * Never pass user input to Path constructor in models_dir validation CodeQL traces taint through Path(resolved) even after a startswith barrier guard. Fix: the user-supplied models_dir is only used as a string for comparison against allowed roots. The Path object passed to _scan_models_dir comes from the trusted allowed_roots list, not from user input. This fully breaks the taint chain. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
529 lines
19 KiB
Python
529 lines
19 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-only
|
|
# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
|
|
|
|
"""
|
|
Model and template mappings for dataset processing.
|
|
|
|
This module contains the mapping dictionaries that associate model names
|
|
with their corresponding chat templates and response markers.
|
|
"""
|
|
|
|
TEMPLATE_TO_MODEL_MAPPER = {
|
|
"phi-3.5": (
|
|
"unsloth/Phi-3.5-mini-instruct-bnb-4bit",
|
|
"unsloth/Phi-3.5-mini-instruct",
|
|
"microsoft/Phi-3.5-mini-instruct",
|
|
),
|
|
"phi-3": (
|
|
"unsloth/Phi-3-mini-4k-instruct-bnb-4bit",
|
|
"unsloth/Phi-3-mini-4k-instruct",
|
|
"microsoft/Phi-3-mini-4k-instruct",
|
|
"unsloth/Phi-3-medium-4k-instruct-bnb-4bit",
|
|
"unsloth/Phi-3-medium-4k-instruct",
|
|
"microsoft/Phi-3-medium-4k-instruct",
|
|
"unsloth/Phi-3-mini-4k-instruct-v0-bnb-4bit",
|
|
"unsloth/Phi-3-mini-4k-instruct-v0",
|
|
),
|
|
"phi-4": (
|
|
"unsloth/phi-4-unsloth-bnb-4bit",
|
|
"unsloth/phi-4",
|
|
"microsoft/phi-4",
|
|
"unsloth/phi-4-bnb-4bit",
|
|
"unsloth/phi-4-reasoning-unsloth-bnb-4bit",
|
|
"unsloth/phi-4-reasoning",
|
|
"microsoft/Phi-4-reasoning",
|
|
"unsloth/phi-4-reasoning-bnb-4bit",
|
|
"unsloth/phi-4-reasoning-plus-unsloth-bnb-4bit",
|
|
"unsloth/phi-4-reasoning-plus",
|
|
"microsoft/Phi-4-reasoning-plus",
|
|
"unsloth/phi-4-reasoning-plus-bnb-4bit",
|
|
"unsloth/phi-4-mini-reasoning-unsloth-bnb-4bit",
|
|
"unsloth/phi-4-mini-reasoning",
|
|
"microsoft/Phi-4-mini-reasoning",
|
|
"unsloth/phi-4-mini-reasoning-bnb-4bit",
|
|
"unsloth/Phi-4-mini-instruct-unsloth-bnb-4bit",
|
|
"unsloth/Phi-4-mini-instruct",
|
|
"microsoft/Phi-4-mini-instruct",
|
|
"unsloth/Phi-4-mini-instruct-bnb-4bit",
|
|
),
|
|
"mistral": (
|
|
"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",
|
|
"unsloth/mistral-7b-instruct-v0.2",
|
|
"mistralai/Mistral-7B-Instruct-v0.2",
|
|
"unsloth/mistral-7b-instruct-v0.3-bnb-4bit",
|
|
"unsloth/mistral-7b-instruct-v0.3",
|
|
"mistralai/Mistral-7B-Instruct-v0.3",
|
|
"unsloth/Mixtral-8x7B-Instruct-v0.1-unsloth-bnb-4bit",
|
|
"unsloth/Mixtral-8x7B-Instruct-v0.1",
|
|
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
|
"unsloth/Mixtral-8x7B-Instruct-v0.1-bnb-4bit",
|
|
"unsloth/Mistral-Nemo-Instruct-2407-bnb-4bit",
|
|
"unsloth/Mistral-Nemo-Instruct-2407",
|
|
"mistralai/Mistral-Nemo-Instruct-2407",
|
|
"unsloth/Mistral-Large-Instruct-2407-bnb-4bit",
|
|
"mistralai/Mistral-Large-Instruct-2407",
|
|
"unsloth/Mistral-Small-Instruct-2409-bnb-4bit",
|
|
"unsloth/Mistral-Small-Instruct-2409",
|
|
"mistralai/Mistral-Small-Instruct-2409",
|
|
"unsloth/Mistral-Small-24B-Instruct-2501-unsloth-bnb-4bit",
|
|
"unsloth/Mistral-Small-24B-Instruct-2501",
|
|
"mistralai/Mistral-Small-24B-Instruct-2501",
|
|
"unsloth/Mistral-Small-24B-Instruct-2501-bnb-4bit",
|
|
"unsloth/Mistral-Small-3.1-24B-Instruct-2503-unsloth-bnb-4bit",
|
|
"unsloth/Mistral-Small-3.1-24B-Instruct-2503",
|
|
"mistralai/Mistral-Small-3.1-24B-Instruct-2503",
|
|
"unsloth/Mistral-Small-3.1-24B-Instruct-2503-bnb-4bit",
|
|
"unsloth/Mistral-Small-3.2-24B-Instruct-2506-unsloth-bnb-4bit",
|
|
"unsloth/Mistral-Small-3.2-24B-Instruct-2506",
|
|
"mistralai/Mistral-Small-3.2-24B-Instruct-2506",
|
|
"unsloth/Mistral-Small-3.2-24B-Instruct-2506-bnb-4bit",
|
|
),
|
|
"llama": (
|
|
"meta-llama/Llama-2-13b-chat-hf",
|
|
"unsloth/llama-2-7b-chat-bnb-4bit",
|
|
"unsloth/llama-2-7b-chat",
|
|
"meta-llama/Llama-2-7b-chat-hf",
|
|
),
|
|
"llama3": (
|
|
"unsloth/llama-3-8b-Instruct-bnb-4bit",
|
|
"unsloth/llama-3-8b-Instruct",
|
|
"meta-llama/Meta-Llama-3-8B-Instruct",
|
|
"unsloth/llama-3-70b-Instruct-bnb-4bit",
|
|
"meta-llama/Meta-Llama-3-70B-Instruct",
|
|
),
|
|
"llama-3.1": (
|
|
"unsloth/Meta-Llama-3.1-8B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Meta-Llama-3.1-8B-Instruct",
|
|
"meta-llama/Meta-Llama-3.1-8B-Instruct",
|
|
"unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit",
|
|
"unsloth/Llama-3.1-8B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Llama-3.1-8B-Instruct",
|
|
"meta-llama/Llama-3.1-8B-Instruct",
|
|
"unsloth/Llama-3.1-8B-Instruct-bnb-4bit",
|
|
"unsloth/Meta-Llama-3.1-405B-Instruct-bnb-4bit",
|
|
"meta-llama/Meta-Llama-3.1-405B-Instruct",
|
|
"unsloth/Meta-Llama-3.1-70B-Instruct-bnb-4bit",
|
|
"unsloth/Meta-Llama-3.1-70B-Instruct",
|
|
"meta-llama/Meta-Llama-3.1-70B-Instruct",
|
|
"unsloth/Llama-3.1-Storm-8B-bnb-4bit",
|
|
"unsloth/Llama-3.1-Storm-8B",
|
|
"akjindal53244/Llama-3.1-Storm-8B",
|
|
"unsloth/Hermes-3-Llama-3.1-8B-bnb-4bit",
|
|
"unsloth/Hermes-3-Llama-3.1-8B",
|
|
"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",
|
|
"NousResearch/Hermes-3-Llama-3.1-405B",
|
|
"unsloth/Llama-3.1-Nemotron-70B-Instruct-bnb-4bit",
|
|
"unsloth/Llama-3.1-Nemotron-70B-Instruct",
|
|
"nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
|
|
"unsloth/Llama-3.1-Tulu-3-8B-bnb-4bit",
|
|
"unsloth/Llama-3.1-Tulu-3-8B",
|
|
"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",
|
|
),
|
|
"llama-3.2": (
|
|
"unsloth/Llama-3.2-1B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Llama-3.2-1B-Instruct",
|
|
"meta-llama/Llama-3.2-1B-Instruct",
|
|
"unsloth/Llama-3.2-1B-Instruct-bnb-4bit",
|
|
"unsloth/Llama-3.2-3B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Llama-3.2-3B-Instruct",
|
|
"meta-llama/Llama-3.2-3B-Instruct",
|
|
"unsloth/Llama-3.2-3B-Instruct-bnb-4bit",
|
|
"unsloth/Llama-3.2-11B-Vision-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Llama-3.2-11B-Vision-Instruct",
|
|
"meta-llama/Llama-3.2-11B-Vision-Instruct",
|
|
"unsloth/Llama-3.2-11B-Vision-Instruct-bnb-4bit",
|
|
"unsloth/Llama-3.2-90B-Vision-Instruct-bnb-4bit",
|
|
"unsloth/Llama-3.2-90B-Vision-Instruct",
|
|
"meta-llama/Llama-3.2-90B-Vision-Instruct",
|
|
),
|
|
"llama-3.3": (
|
|
"unsloth/Llama-3.3-70B-Instruct-bnb-4bit",
|
|
"unsloth/Llama-3.3-70B-Instruct",
|
|
"meta-llama/Llama-3.3-70B-Instruct",
|
|
),
|
|
"gemma": (
|
|
"unsloth/gemma-7b-it-bnb-4bit",
|
|
"unsloth/gemma-7b-it",
|
|
"google/gemma-7b-it",
|
|
"google/gemma-2b-it",
|
|
"unsloth/gemma-1.1-2b-it-bnb-4bit",
|
|
"unsloth/gemma-1.1-2b-it",
|
|
"google/gemma-1.1-2b-it",
|
|
"unsloth/gemma-1.1-7b-it-bnb-4bit",
|
|
"unsloth/gemma-1.1-7b-it",
|
|
"google/gemma-1.1-7b-it",
|
|
),
|
|
"gemma2": (
|
|
"unsloth/gemma-2-9b-it-bnb-4bit",
|
|
"unsloth/gemma-2-9b-it",
|
|
"google/gemma-2-9b-it",
|
|
"unsloth/gemma-2-27b-it-bnb-4bit",
|
|
"unsloth/gemma-2-27b-it",
|
|
"google/gemma-2-27b-it",
|
|
"unsloth/gemma-2-2b-it-bnb-4bit",
|
|
"unsloth/gemma-2-2b-it",
|
|
"google/gemma-2-2b-it",
|
|
),
|
|
"gemma-3": (
|
|
"unsloth/gemma-3-1b-it-unsloth-bnb-4bit",
|
|
"unsloth/gemma-3-1b-it",
|
|
"google/gemma-3-1b-it",
|
|
"unsloth/gemma-3-1b-it-bnb-4bit",
|
|
"unsloth/gemma-3-4b-it-unsloth-bnb-4bit",
|
|
"unsloth/gemma-3-4b-it",
|
|
"google/gemma-3-4b-it",
|
|
"unsloth/gemma-3-4b-it-bnb-4bit",
|
|
"unsloth/gemma-3-12b-it-unsloth-bnb-4bit",
|
|
"unsloth/gemma-3-12b-it",
|
|
"google/gemma-3-12b-it",
|
|
"unsloth/gemma-3-12b-it-bnb-4bit",
|
|
"unsloth/gemma-3-27b-it-unsloth-bnb-4bit",
|
|
"unsloth/gemma-3-27b-it",
|
|
"google/gemma-3-27b-it",
|
|
"unsloth/gemma-3-27b-it-bnb-4bit",
|
|
"unsloth/gemma-3-270m-it-unsloth-bnb-4bit",
|
|
"unsloth/gemma-3-270m-it",
|
|
"google/gemma-3-270m-it",
|
|
"unsloth/gemma-3-270m-it-bnb-4bit",
|
|
"unsloth/gemma-3-270m-unsloth-bnb-4bit",
|
|
"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",
|
|
),
|
|
"gemma3n": (
|
|
"unsloth/gemma-3n-E4B-it-unsloth-bnb-4bit",
|
|
"unsloth/gemma-3n-E4B-it",
|
|
"google/gemma-3n-E4B-it",
|
|
"unsloth/gemma-3n-E4B-it-unsloth-bnb-4bit",
|
|
"unsloth/gemma-3n-E2B-it-unsloth-bnb-4bit",
|
|
"unsloth/gemma-3n-E2B-it",
|
|
"google/gemma-3n-E2B-it",
|
|
"unsloth/gemma-3n-E2B-it-unsloth-bnb-4bit",
|
|
),
|
|
"qwen2.5": (
|
|
"unsloth/Qwen2.5-0.5B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Qwen2.5-0.5B-Instruct",
|
|
"Qwen/Qwen2.5-0.5B-Instruct",
|
|
"unsloth/Qwen2.5-0.5B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-1.5B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Qwen2.5-1.5B-Instruct",
|
|
"Qwen/Qwen2.5-1.5B-Instruct",
|
|
"unsloth/Qwen2.5-1.5B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-3B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Qwen2.5-3B-Instruct",
|
|
"Qwen/Qwen2.5-3B-Instruct",
|
|
"unsloth/Qwen2.5-3B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-7B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Qwen2.5-7B-Instruct",
|
|
"Qwen/Qwen2.5-7B-Instruct",
|
|
"unsloth/Qwen2.5-7B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-14B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Qwen2.5-14B-Instruct",
|
|
"Qwen/Qwen2.5-14B-Instruct",
|
|
"unsloth/Qwen2.5-14B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-32B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-32B-Instruct",
|
|
"Qwen/Qwen2.5-32B-Instruct",
|
|
"unsloth/Qwen2.5-72B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-72B-Instruct",
|
|
"Qwen/Qwen2.5-72B-Instruct",
|
|
"unsloth/Qwen2.5-0.5B-unsloth-bnb-4bit",
|
|
"unsloth/Qwen2.5-Math-1.5B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-Math-1.5B-Instruct",
|
|
"Qwen/Qwen2.5-Math-1.5B-Instruct",
|
|
"unsloth/Qwen2.5-Math-7B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-Math-7B-Instruct",
|
|
"Qwen/Qwen2.5-Math-7B-Instruct",
|
|
"unsloth/Qwen2.5-Math-72B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-Math-72B-Instruct",
|
|
"Qwen/Qwen2.5-Math-72B-Instruct",
|
|
"unsloth/Qwen2.5-Coder-0.5B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-Coder-0.5B-Instruct",
|
|
"Qwen/Qwen2.5-Coder-0.5B-Instruct",
|
|
"unsloth/Qwen2.5-Coder-1.5B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-Coder-1.5B-Instruct",
|
|
"Qwen/Qwen2.5-Coder-1.5B-Instruct",
|
|
"unsloth/Qwen2.5-Coder-3B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-Coder-3B-Instruct",
|
|
"Qwen/Qwen2.5-Coder-3B-Instruct",
|
|
"unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-Coder-7B-Instruct",
|
|
"Qwen/Qwen2.5-Coder-7B-Instruct",
|
|
"unsloth/Qwen2.5-Coder-14B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-Coder-14B-Instruct",
|
|
"Qwen/Qwen2.5-Coder-14B-Instruct",
|
|
"unsloth/Qwen2.5-Coder-32B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-Coder-32B-Instruct",
|
|
"Qwen/Qwen2.5-Coder-32B-Instruct",
|
|
"unsloth/Qwen2.5-VL-3B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Qwen2.5-VL-3B-Instruct",
|
|
"Qwen/Qwen2.5-VL-3B-Instruct",
|
|
"unsloth/Qwen2.5-VL-3B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-VL-7B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Qwen2.5-VL-7B-Instruct",
|
|
"Qwen/Qwen2.5-VL-7B-Instruct",
|
|
"unsloth/Qwen2.5-VL-7B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-VL-32B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Qwen2.5-VL-32B-Instruct",
|
|
"Qwen/Qwen2.5-VL-32B-Instruct",
|
|
"unsloth/Qwen2.5-VL-32B-Instruct-bnb-4bit",
|
|
"unsloth/Qwen2.5-VL-72B-Instruct-unsloth-bnb-4bit",
|
|
"unsloth/Qwen2.5-VL-72B-Instruct",
|
|
"Qwen/Qwen2.5-VL-72B-Instruct",
|
|
"unsloth/Qwen2.5-VL-72B-Instruct-bnb-4bit",
|
|
"unsloth/OpenThinker-7B-unsloth-bnb-4bit",
|
|
"unsloth/OpenThinker-7B",
|
|
"open-thoughts/OpenThinker-7B",
|
|
"unsloth/OpenThinker-7B-bnb-4bit",
|
|
),
|
|
"qwen3": (
|
|
"unsloth/Qwen3-0.6B-unsloth-bnb-4bit",
|
|
"unsloth/Qwen3-0.6B",
|
|
"Qwen/Qwen3-0.6B",
|
|
"unsloth/Qwen3-0.6B-bnb-4bit",
|
|
"unsloth/Qwen3-1.7B-unsloth-bnb-4bit",
|
|
"unsloth/Qwen3-1.7B",
|
|
"Qwen/Qwen3-1.7B",
|
|
"unsloth/Qwen3-1.7B-bnb-4bit",
|
|
"unsloth/Qwen3-4B-unsloth-bnb-4bit",
|
|
"unsloth/Qwen3-4B",
|
|
"Qwen/Qwen3-4B",
|
|
"unsloth/Qwen3-4B-bnb-4bit",
|
|
"unsloth/Qwen3-8B-unsloth-bnb-4bit",
|
|
"unsloth/Qwen3-8B",
|
|
"Qwen/Qwen3-8B",
|
|
"unsloth/Qwen3-8B-bnb-4bit",
|
|
"unsloth/Qwen3-14B-unsloth-bnb-4bit",
|
|
"unsloth/Qwen3-14B",
|
|
"Qwen/Qwen3-14B",
|
|
"unsloth/Qwen3-14B-bnb-4bit",
|
|
"unsloth/Qwen3-32B-unsloth-bnb-4bit",
|
|
"unsloth/Qwen3-32B",
|
|
"Qwen/Qwen3-32B",
|
|
"unsloth/Qwen3-32B-bnb-4bit",
|
|
"unsloth/Qwen3-30B-A3B-unsloth-bnb-4bit",
|
|
"unsloth/Qwen3-30B-A3B",
|
|
"Qwen/Qwen3-30B-A3B",
|
|
"unsloth/Qwen3-30B-A3B-bnb-4bit",
|
|
),
|
|
"qwen3-instruct": (
|
|
"unsloth/Qwen3-4B-Instruct-2507-unsloth-bnb-4bit",
|
|
"unsloth/Qwen3-4B-Instruct-2507",
|
|
"Qwen/Qwen3-4B-Instruct-2507",
|
|
"unsloth/Qwen3-4B-Instruct-2507-bnb-4bit",
|
|
"unsloth/Qwen3-30B-A3B-Instruct-2507",
|
|
"Qwen/Qwen3-30B-A3B-Instruct-2507",
|
|
"unsloth/Qwen3-Coder-30B-A3B-Instruct",
|
|
"Qwen/Qwen3-Coder-30B-A3B-Instruct",
|
|
"unsloth/Qwen3-4B-Instruct-2507-unsloth-bnb-4bit",
|
|
"unsloth/Qwen3-4B-Instruct-2507",
|
|
"Qwen/Qwen3-4B-Instruct-2507",
|
|
"unsloth/Qwen3-4B-Instruct-2507-bnb-4bit",
|
|
),
|
|
"qwen3-thinking": (
|
|
"unsloth/QwQ-32B-Preview-bnb-4bit",
|
|
"unsloth/QwQ-32B-Preview",
|
|
"Qwen/QwQ-32B-Preview",
|
|
"unsloth/QwQ-32B-unsloth-bnb-4bit",
|
|
"unsloth/QwQ-32B",
|
|
"Qwen/QwQ-32B",
|
|
"unsloth/QwQ-32B-bnb-4bit",
|
|
"unsloth/Qwen3-4B-Thinking-2507-unsloth-bnb-4bit",
|
|
"unsloth/Qwen3-4B-Thinking-2507",
|
|
"Qwen/Qwen3-4B-Thinking-2507",
|
|
"unsloth/Qwen3-4B-Thinking-2507-bnb-4bit",
|
|
"unsloth/Qwen3-30B-A3B-Thinking-2507",
|
|
"Qwen/Qwen3-30B-A3B-Thinking-2507",
|
|
),
|
|
"qwen3.5": (
|
|
"unsloth/Qwen3.5-0.8B",
|
|
"unsloth/Qwen3.5-2B",
|
|
"unsloth/Qwen3.5-4B",
|
|
"unsloth/Qwen3.5-27B",
|
|
"unsloth/Qwen3.5-35B-A3B",
|
|
),
|
|
"zephyr": (
|
|
"unsloth/zephyr-sft-bnb-4bit",
|
|
"unsloth/zephyr-sft",
|
|
"HuggingFaceH4/mistral-7b-sft-beta",
|
|
),
|
|
"chatml": (
|
|
"unsloth/yi-6b-bnb-4bit",
|
|
"unsloth/yi-6b",
|
|
"01-ai/Yi-6B",
|
|
"unsloth/Hermes-2-Pro-Mistral-7B-bnb-4bit",
|
|
"unsloth/Hermes-2-Pro-Mistral-7B",
|
|
"NousResearch/Hermes-2-Pro-Mistral-7B",
|
|
"unsloth/OpenHermes-2.5-Mistral-7B-bnb-4bit",
|
|
"unsloth/OpenHermes-2.5-Mistral-7B",
|
|
"teknium/OpenHermes-2.5-Mistral-7B",
|
|
),
|
|
"gpt-oss": (
|
|
"unsloth/gpt-oss-20b-unsloth-bnb-4bit",
|
|
"unsloth/gpt-oss-20b",
|
|
"openai/gpt-oss-20b",
|
|
"unsloth/gpt-oss-20b-unsloth-bnb-4bit",
|
|
"unsloth/gpt-oss-120b-unsloth-bnb-4bit",
|
|
"unsloth/gpt-oss-120b",
|
|
"openai/gpt-oss-120b",
|
|
"unsloth/gpt-oss-120b-unsloth-bnb-4bit",
|
|
),
|
|
"starling": (
|
|
"unsloth/Starling-LM-7B-beta-bnb-4bit",
|
|
"unsloth/Starling-LM-7B-beta",
|
|
"Nexusflow/Starling-LM-7B-beta",
|
|
),
|
|
"yi-chat": (
|
|
"unsloth/yi-34b-chat-bnb-4bit",
|
|
"01-ai/Yi-6B-Chat",
|
|
"01-ai/Yi-34B-Chat",
|
|
),
|
|
"glm": (
|
|
"unsloth/GLM-4.7-Flash-unsloth-bnb-4bit",
|
|
"unsloth/GLM-4.7-Flash",
|
|
"THUDM/GLM-4.7-Flash",
|
|
"unsloth/GLM-4.7-Flash-bnb-4bit",
|
|
),
|
|
}
|
|
|
|
MODEL_TO_TEMPLATE_MAPPER = {}
|
|
|
|
for key, values in TEMPLATE_TO_MODEL_MAPPER.items():
|
|
for value in values:
|
|
MODEL_TO_TEMPLATE_MAPPER[value] = key
|
|
|
|
# Get lowercased
|
|
lowered_key = key.lower()
|
|
for value in values:
|
|
MODEL_TO_TEMPLATE_MAPPER[value.lower()] = lowered_key
|
|
|
|
|
|
TEMPLATE_TO_RESPONSES_MAPPER = {
|
|
"gemma-3": {
|
|
"instruction": "<start_of_turn>user\n",
|
|
"response": "<start_of_turn>model\n",
|
|
},
|
|
"gemma3n": {
|
|
"instruction": "<start_of_turn>user\n",
|
|
"response": "<start_of_turn>model\n",
|
|
},
|
|
"qwen3.5": {
|
|
"instruction": "<|im_start|>user\n",
|
|
"response": "<|im_start|>assistant\n<think>\n",
|
|
},
|
|
"qwen3-instruct": {
|
|
"instruction": "<|im_start|>user\n",
|
|
"response": "<|im_start|>assistant\n",
|
|
},
|
|
"qwen3-thinking": {
|
|
"instruction": "<|im_start|>user\n",
|
|
"response": "<|im_start|>assistant\n<think>\n",
|
|
},
|
|
"qwen3": {
|
|
"instruction": "<|im_start|>user\n",
|
|
"response": "<|im_start|>assistant\n",
|
|
},
|
|
"qwen2.5": {
|
|
"instruction": "<|im_start|>user\n",
|
|
"response": "<|im_start|>assistant\n",
|
|
},
|
|
"llama-3.2": {
|
|
"instruction": "<|start_header_id|>user<|end_header_id|>\n\n",
|
|
"response": "<|start_header_id|>assistant<|end_header_id|>\n\n",
|
|
},
|
|
"llama-3.3": {
|
|
"instruction": "<|start_header_id|>user<|end_header_id|>\n\n",
|
|
"response": "<|start_header_id|>assistant<|end_header_id|>\n\n",
|
|
},
|
|
"llama-3.1": {
|
|
"instruction": "<|start_header_id|>user<|end_header_id|>\n\n",
|
|
"response": "<|start_header_id|>assistant<|end_header_id|>\n\n",
|
|
},
|
|
"llama3": {
|
|
"instruction": "<|start_header_id|>user<|end_header_id|>\n\n",
|
|
"response": "<|start_header_id|>assistant<|end_header_id|>\n\n",
|
|
},
|
|
"phi-3": {
|
|
"instruction": "<|user|>\n",
|
|
"response": "<|assistant|>\n",
|
|
},
|
|
"phi-3.5": {
|
|
"instruction": "<|user|>\n",
|
|
"response": "<|assistant|>\n",
|
|
},
|
|
"phi-4": {
|
|
"instruction": "<|im_start|>user<|im_sep|>",
|
|
"response": "<|im_start|>assistant<|im_sep|>",
|
|
},
|
|
"mistral": {
|
|
"instruction": "[INST] ",
|
|
"response": " [/INST]",
|
|
},
|
|
"llama": {
|
|
"instruction": "[INST] ",
|
|
"response": " [/INST]",
|
|
},
|
|
"chatml": {
|
|
"instruction": "<|im_start|>user\n",
|
|
"response": "<|im_start|>assistant\n",
|
|
},
|
|
"zephyr": {
|
|
"instruction": "<|user|>\n",
|
|
"response": "<|assistant|>\n",
|
|
},
|
|
"unsloth": {
|
|
"instruction": ">>> User: ",
|
|
"response": ">>> Assistant: ",
|
|
},
|
|
"vicuna": {
|
|
"instruction": "USER: ",
|
|
"response": "ASSISTANT: ",
|
|
},
|
|
"alpaca": {
|
|
"instruction": "### Instruction:\n",
|
|
"response": "### Response:\n",
|
|
},
|
|
"gemma": {
|
|
"instruction": "<start_of_turn>user\n",
|
|
"response": "<start_of_turn>model\n",
|
|
},
|
|
"gemma2": {
|
|
"instruction": "<start_of_turn>user\n",
|
|
"response": "<start_of_turn>model\n",
|
|
},
|
|
"gpt-oss": {
|
|
"instruction": "<|start|>user<|message|>",
|
|
"response": "<|start|>assistant<|channel|>final<|message|>",
|
|
},
|
|
"lfm-2": {
|
|
"instruction": "<|im_start|>user\n",
|
|
"response": "<|im_start|>assistant\n",
|
|
},
|
|
"starling": {
|
|
"instruction": "GPT4 Correct User: ",
|
|
"response": "GPT4 Correct Assistant: ",
|
|
},
|
|
"yi-chat": {
|
|
"instruction": "<|im_start|>user\n",
|
|
"response": "<|im_start|>assistant\n",
|
|
},
|
|
"glm": {
|
|
"instruction": "[gMASK]<sop><|user|>",
|
|
"response": "<|assistant|><think>",
|
|
},
|
|
}
|