fixup qwen3

Signed-off-by: Dattu Sharma <venkatadattasainimmaturi@gmail.com>
This commit is contained in:
Dattu Sharma 2025-04-28 18:41:23 +00:00
commit 326daf095f
3 changed files with 4 additions and 2 deletions

View file

@ -248,7 +248,7 @@ model_architectures = ["llama", "mistral", "gemma", "gemma2", "qwen2", "granite"
for model_name in model_architectures:
config_filepath = f"transformers.models.{model_name}.configuration_{model_name}"
model_filepath = f"transformers.models.{model_name}.modeling_{model_name}"
config_filename = f"{model_name.title()}Config"
config_filename = f"{model_name.title().replace('_','')}Config" # qwen3 arch folder is qwen3_moe but config is Qwen3Config. Need to remove underscore(_) for now
exec(f"from {config_filepath} import {config_filename}", globals())
try:

View file

@ -2487,6 +2487,8 @@ class FastLlamaModel:
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 == "qwen3moe": apply_lora_mlp = apply_lora_mlp_swiglu
else:
raise NotImplementedError(f"Unsloth: {model_type} is not yet implemented!")
pass

View file

@ -216,7 +216,7 @@ class FastQwen3Model(FastLlamaModel):
# https://github.com/huggingface/transformers/pull/27931
# https://github.com/huggingface/transformers/blob/v4.37.2/src/transformers/models/llama/modeling_llama.py
import transformers.models.qwen3.modeling_qwen3
transformers.models.Qwen3.modeling_qwen3.Qwen3RotaryEmbedding = LlamaRotaryEmbedding
transformers.models.qwen3.modeling_qwen3.Qwen3RotaryEmbedding = LlamaRotaryEmbedding
return
pass