Skip to content

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.

Qwen2

Daniel Han-Chen5774e75a1e20
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py
index 9c9b45dbaed..ea5dabf7388 100644
--- a/unsloth/models/llama.py
+++ b/unsloth/models/llama.py
@@ -1782,10 +1782,12 @@ class FastLlamaModel:
layer.self_attn.apply_qkv = apply_lora_qkv
n_qkv += 1
else:
- logger.warning_once(
- "Not an error, but Unsloth cannot patch Attention layers with our manual autograd engine since either LoRA adapters\n"\
- "are not enabled or a bias term (like in Qwen) is used."
- )
+ if model_type != "qwen2":
+ logger.warning_once(
+ "Not an error, but Unsloth cannot patch Attention layers with our manual autograd engine since either LoRA adapters\n"\
+ "are not enabled or a bias term (like in Qwen) is used."
+ )
+ pass
pass
# O attention patching
diff --git a/unsloth/models/mapper.py b/unsloth/models/mapper.py
index 777f310c73d..8808b8554d2 100644
--- a/unsloth/models/mapper.py
+++ b/unsloth/models/mapper.py
@@ -156,6 +156,36 @@ __INT_TO_FLOAT_MAPPER = \
"unsloth/Phi-3-medium-4k-instruct",
"microsoft/Phi-3-medium-4k-instruct",
),
+ "unsloth/Qwen2-0.5B-bnb-4bit" : (
+ "unsloth/Qwen2-0.5B",
+ "Qwen/Qwen2-0.5B",
+ ),
+ "unsloth/Qwen2-0.5B-Instruct-bnb-4bit" : (
+ "unsloth/Qwen2-0.5B-Instruct",
+ "Qwen/Qwen2-0.5B-Instruct",
+ ),
+ "unsloth/Qwen2-1.5B-bnb-4bit" : (
+ "unsloth/Qwen2-1.5B",
+ "Qwen/Qwen2-1.5B",
+ ),
+ "unsloth/Qwen2-1.5B-Instruct-bnb-4bit" : (
+ "unsloth/Qwen2-1.5B-Instruct",
+ "Qwen/Qwen2-1.5B-Instruct",
+ ),
+ "unsloth/Qwen2-7B-bnb-4bit" : (
+ "unsloth/Qwen2-7B",
+ "Qwen/Qwen2-7B",
+ ),
+ "unsloth/Qwen2-7B-Instruct-bnb-4bit" : (
+ "unsloth/Qwen2-7B-Instruct",
+ "Qwen/Qwen2-7B-Instruct",
+ ),
+ "unsloth/Qwen2-70B-bnb-4bit" : (
+ "Qwen/Qwen2-70B",
+ ),
+ "unsloth/Qwen2-70B-Instruct-bnb-4bit" : (
+ "Qwen/Qwen2-70B-Instruct",
+ ),
}
INT_TO_FLOAT_MAPPER = {}