Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/transformers/models/qwen3_moe/configuration_qwen3_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ class Qwen3MoeConfig(PreTrainedConfig):
model_type = "qwen3_moe"
keys_to_ignore_at_inference = ["past_key_values"]

attribute_map = {
"num_experts": "num_local_experts",
}

# Default tensor parallel plan for base model `Qwen3Moe`
base_model_tp_plan = {
"layers.*.self_attn.q_proj": "colwise",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ class Qwen3OmniMoeTalkerTextConfig(PreTrainedConfig):
model_type = "qwen3_omni_moe_talker_text"
keys_to_ignore_at_inference = ["past_key_values"]

attribute_map = {
"num_experts": "num_local_experts",
}

# Default tensor parallel plan for base model `Qwen3OmniMoeTalkerText`
base_model_tp_plan = {
"layers.*.self_attn.q_proj": "colwise",
Expand Down
12 changes: 12 additions & 0 deletions tests/quantization/finegrained_fp8/test_fp8.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
from contextlib import ExitStack, contextmanager
from unittest.mock import patch

from parameterized import parameterized

from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, FineGrainedFP8Config, OPTForCausalLM
from transformers.quantizers.quantizer_finegrained_fp8 import FineGrainedFP8HfQuantizer
from transformers.testing_utils import (
Expand Down Expand Up @@ -137,6 +139,16 @@ def tearDown(self):
backend_empty_cache(torch_device)
gc.collect()

@parameterized.expand(
[
"hf-internal-testing/tiny-random-Qwen3MoeForCausalLM",
"hf-internal-testing/tiny-random-MixtralForCausalLM",
]
)
def test_moe_conversion_doesnt_raise(self, model_id):
quantization_config = FineGrainedFP8Config(weight_block_size=(32, 32))
AutoModelForCausalLM.from_pretrained(model_id, quantization_config=quantization_config)

def test_quantized_model_conversion(self):
"""
Simple test that checks if the quantized model has been converted properly
Expand Down