Skip to content

Commit d1782d0

Browse files
committed
add qwen2moe support
1 parent 6e3b010 commit d1782d0

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

optimum/exporters/openvino/model_configs.py

+9
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ class Qwen2OpenVINOConfig(TextDecoderWithPositionIdsOnnxConfig):
115115
NORMALIZED_CONFIG_CLASS = NormalizedTextConfig
116116

117117

118+
@register_in_tasks_manager("qwen2-moe", *["text-generation", "text-generation-with-past"], library_name="transformers")
119+
class Qwen2MoEOpenVINOConfig(TextDecoderWithPositionIdsOnnxConfig):
120+
DEFAULT_ONNX_OPSET = 14
121+
122+
DUMMY_INPUT_GENERATOR_CLASSES = (DummyTextInputGenerator, MistralDummyPastKeyValuesGenerator)
123+
DUMMY_PKV_GENERATOR_CLASS = MistralDummyPastKeyValuesGenerator
124+
NORMALIZED_CONFIG_CLASS = NormalizedTextConfig
125+
126+
118127
@register_in_tasks_manager("minicpm", *["text-generation", "text-generation-with-past"], library_name="transformers")
119128
class MiniCPMOpenVINOConfig(TextDecoderWithPositionIdsOnnxConfig):
120129
DEFAULT_ONNX_OPSET = 14

tests/openvino/test_modeling.py

+1
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase):
563563
"xverse",
564564
"internlm",
565565
"dbrx",
566+
"qwen2-moe",
566567
)
567568
GENERATION_LENGTH = 100
568569
REMOTE_CODE_MODELS = (

tests/openvino/utils_tests.py

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"poolformer": "hf-internal-testing/tiny-random-PoolFormerModel",
9494
"qwen": "katuni4ka/tiny-random-qwen",
9595
"qwen2": "Qwen/Qwen1.5-0.5B",
96+
"qwen2-moe": "yujiepan/qwen1.5-moe-tiny-random",
9697
"resnet": "hf-internal-testing/tiny-random-resnet",
9798
"roberta": "hf-internal-testing/tiny-random-roberta",
9899
"roformer": "hf-internal-testing/tiny-random-roformer",

0 commit comments

Comments
 (0)