Add Mistral Large 3 and Ministral 3 (#29757)
Signed-off-by: Julien Denize <julien.denize@mistral.ai> Signed-off-by: Julien Denize <40604584+juliendenize@users.noreply.github.com> Signed-off-by: Mickael Seznec <mickael@mistral.ai> Signed-off-by: Roger Wang <hey@rogerw.io> Co-authored-by: Roger Wang <hey@rogerw.io> Co-authored-by: Mickael Seznec <mickael@mistral.ai>
This commit is contained in:
co-authored by
Roger Wang
Mickael Seznec
parent
8bbcf8b6e7
commit
d8c6210eea
@@ -358,6 +358,9 @@ _TEXT_GENERATION_EXAMPLE_MODELS = {
|
||||
trust_remote_code=True,
|
||||
),
|
||||
"MistralForCausalLM": _HfExamplesInfo("mistralai/Mistral-7B-Instruct-v0.1"),
|
||||
"MistralLarge3ForCausalLM": _HfExamplesInfo(
|
||||
"mistralai/Mistral-Large-3-675B-Instruct-2512-NVFP4", is_available_online=False
|
||||
),
|
||||
"MixtralForCausalLM": _HfExamplesInfo(
|
||||
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
||||
{"tiny": "TitanML/tiny-mixtral"},
|
||||
@@ -770,7 +773,13 @@ _MULTIMODAL_EXAMPLE_MODELS = {
|
||||
),
|
||||
"PixtralForConditionalGeneration": _HfExamplesInfo(
|
||||
"mistralai/Pixtral-12B-2409",
|
||||
extras={
|
||||
"mistral-large-3": "mistralai/Mistral-Large-3-675B-Instruct-2512-NVFP4",
|
||||
"ministral-3": "mistralai/Ministral-3-3B-Instruct-2512",
|
||||
},
|
||||
tokenizer_mode="mistral",
|
||||
# TODO: revert once Mistral-Large-3 and Ministral-3 are publicly available.
|
||||
is_available_online=False,
|
||||
),
|
||||
"QwenVLForConditionalGeneration": _HfExamplesInfo(
|
||||
"Qwen/Qwen-VL",
|
||||
@@ -870,6 +879,11 @@ _SPECULATIVE_DECODING_EXAMPLE_MODELS = {
|
||||
use_original_num_layers=True,
|
||||
max_model_len=10240,
|
||||
),
|
||||
"EagleMistralLarge3ForCausalLM": _HfExamplesInfo(
|
||||
"mistralai/Mistral-Large-3-675B-Instruct-2512",
|
||||
speculative_model="mistralai/Mistral-Large-3-675B-Instruct-2512-Eagle",
|
||||
is_available_online=False,
|
||||
),
|
||||
"LlamaForCausalLMEagle3": _HfExamplesInfo(
|
||||
"Qwen/Qwen3-8B",
|
||||
trust_remote_code=True,
|
||||
|
||||
@@ -91,6 +91,118 @@ from vllm.tokenizers.mistral import (
|
||||
],
|
||||
),
|
||||
),
|
||||
(
|
||||
{
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "What is the current local date and time?",
|
||||
}
|
||||
],
|
||||
"tools": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"description": "Fetch the current local date and time.",
|
||||
"unsupported_field": False,
|
||||
"name": "get_current_time",
|
||||
"parameters": {},
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"description": "Fetch the current local date and time.",
|
||||
"unsupported_field2": False,
|
||||
"name": "get_current_time",
|
||||
"parameters": {},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
(
|
||||
[
|
||||
{
|
||||
"role": "user",
|
||||
"content": "What is the current local date and time?",
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"description": "Fetch the current local date and time.",
|
||||
"name": "get_current_time",
|
||||
"parameters": {},
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"description": "Fetch the current local date and time.",
|
||||
"name": "get_current_time",
|
||||
"parameters": {},
|
||||
},
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
(
|
||||
{
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "What is the current local date and time?",
|
||||
}
|
||||
],
|
||||
"tools": [
|
||||
{
|
||||
"type": "function",
|
||||
"unsupported_field": False,
|
||||
"function": {
|
||||
"description": "Fetch the current local date and time.",
|
||||
"name": "get_current_time",
|
||||
"parameters": {},
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"unsupported_field2": False,
|
||||
"function": {
|
||||
"description": "Fetch the current local date and time 2.",
|
||||
"name": "get_current_time2",
|
||||
"parameters": {"a": "1"},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
(
|
||||
[
|
||||
{
|
||||
"role": "user",
|
||||
"content": "What is the current local date and time?",
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"description": "Fetch the current local date and time.",
|
||||
"name": "get_current_time",
|
||||
"parameters": {},
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"description": "Fetch the current local date and time 2.",
|
||||
"name": "get_current_time2",
|
||||
"parameters": {"a": "1"},
|
||||
},
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_prepare_apply_chat_template_tools_and_messages(
|
||||
@@ -1108,13 +1220,6 @@ class TestMistralTokenizer:
|
||||
)
|
||||
== expected_tokens[mistral_tokenizer.is_tekken]
|
||||
)
|
||||
assert (
|
||||
mistral_tokenizer.decode(
|
||||
ids[mistral_tokenizer.is_tekken],
|
||||
skip_special_tokens=skip_special_tokens,
|
||||
)
|
||||
== expected_tokens[mistral_tokenizer.is_tekken]
|
||||
)
|
||||
|
||||
def test_decode_empty(
|
||||
self,
|
||||
@@ -1140,6 +1245,45 @@ class TestMistralTokenizer:
|
||||
== "<s>"
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"skip_special_tokens,expected_tokens",
|
||||
(
|
||||
(
|
||||
False,
|
||||
(
|
||||
["<s>[INST]▁Hello▁world▁![/INST]▁Hello</s>"],
|
||||
["<s>[INST]Hello world ![/INST]Hello</s>"],
|
||||
),
|
||||
),
|
||||
(True, (["Hello world ! Hello"], ["Hello world !Hello"])),
|
||||
),
|
||||
)
|
||||
def test_batch_decode(
|
||||
self,
|
||||
mistral_tokenizer: MistralTokenizer,
|
||||
skip_special_tokens: bool,
|
||||
expected_tokens: tuple[str, str],
|
||||
):
|
||||
ids = (
|
||||
[[1, 3, 23325, 2294, 1686, 4, 23325, 2]],
|
||||
[[1, 3, 22177, 4304, 2662, 4, 22177, 2]],
|
||||
)
|
||||
assert (
|
||||
mistral_tokenizer.batch_decode(
|
||||
ids[mistral_tokenizer.is_tekken],
|
||||
skip_special_tokens=skip_special_tokens,
|
||||
)
|
||||
== expected_tokens[mistral_tokenizer.is_tekken]
|
||||
)
|
||||
|
||||
def test_batch_decode_empty(
|
||||
self,
|
||||
mistral_tokenizer: MistralTokenizer,
|
||||
):
|
||||
assert mistral_tokenizer.batch_decode(
|
||||
[[]],
|
||||
) == [""]
|
||||
|
||||
def test_convert_tokens_to_string(self, mistral_tokenizer: MistralTokenizer):
|
||||
tokens = (
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user