forked from Karylab-cklius/vllm
@@ -11,28 +11,19 @@ parser_name = "qwen3"
|
||||
start_token = "<think>"
|
||||
end_token = "</think>"
|
||||
|
||||
REASONING_MODEL_NAME = "Qwen/Qwen3-0.6B"
|
||||
REASONING_MODEL_NAMES = [
|
||||
"Qwen/Qwen3-0.6B",
|
||||
"Qwen/Qwen3.5-397B-A17B",
|
||||
"Qwen/Qwen3-4B-Thinking-2507",
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def qwen3_tokenizer():
|
||||
return AutoTokenizer.from_pretrained(REASONING_MODEL_NAME)
|
||||
@pytest.fixture(scope="module", params=REASONING_MODEL_NAMES)
|
||||
def qwen3_tokenizer(request):
|
||||
return AutoTokenizer.from_pretrained(request.param)
|
||||
|
||||
|
||||
# --- Qwen3 style: both <think> and </think> generated by model ---
|
||||
|
||||
WITH_THINK = {
|
||||
"output": "<think>This is a reasoning section</think>This is the rest",
|
||||
"reasoning": "This is a reasoning section",
|
||||
"content": "This is the rest",
|
||||
}
|
||||
WITH_THINK_STREAM = {
|
||||
"output": "<think>This is a reasoning section</think>This is the rest",
|
||||
"reasoning": "This is a reasoning section",
|
||||
"content": "This is the rest",
|
||||
}
|
||||
|
||||
# --- Qwen3.5 style: <think> in prompt, only </think> in output ---
|
||||
# --- <think> in prompt, only </think> in output (typical) ---
|
||||
|
||||
WITHOUT_START_TOKEN = {
|
||||
"output": "This is a reasoning section</think>This is the rest",
|
||||
@@ -50,6 +41,19 @@ WITHOUT_START_TOKEN_COMPLETE_REASONING = {
|
||||
"content": None,
|
||||
}
|
||||
|
||||
# --- <think> present in output (old template / edge case) ---
|
||||
|
||||
WITH_THINK = {
|
||||
"output": "<think>This is a reasoning section</think>This is the rest",
|
||||
"reasoning": "This is a reasoning section",
|
||||
"content": "This is the rest",
|
||||
}
|
||||
WITH_THINK_STREAM = {
|
||||
"output": "<think>This is a reasoning section</think>This is the rest",
|
||||
"reasoning": "This is a reasoning section",
|
||||
"content": "This is the rest",
|
||||
}
|
||||
|
||||
# --- No think tokens at all (thinking disabled) ---
|
||||
|
||||
WITHOUT_THINK = {
|
||||
@@ -58,7 +62,7 @@ WITHOUT_THINK = {
|
||||
"content": "This is the rest",
|
||||
}
|
||||
# In streaming, the parser cannot distinguish "thinking disabled" from
|
||||
# "Qwen3.5 reasoning in progress" when no think tokens have appeared yet.
|
||||
# "reasoning in progress" when no think tokens have appeared yet.
|
||||
# It assumes reasoning. The serving layer handles the "thinking disabled"
|
||||
# case by checking prompt_is_reasoning_end_arr before calling the parser.
|
||||
WITHOUT_THINK_STREAM = {
|
||||
@@ -92,16 +96,6 @@ ONLY_OPEN_TAG_STREAM = {
|
||||
}
|
||||
|
||||
TEST_CASES = [
|
||||
pytest.param(
|
||||
False,
|
||||
WITH_THINK,
|
||||
id="with_think",
|
||||
),
|
||||
pytest.param(
|
||||
True,
|
||||
WITH_THINK_STREAM,
|
||||
id="with_think_stream",
|
||||
),
|
||||
pytest.param(
|
||||
False,
|
||||
WITHOUT_START_TOKEN,
|
||||
@@ -122,6 +116,16 @@ TEST_CASES = [
|
||||
WITHOUT_START_TOKEN_COMPLETE_REASONING,
|
||||
id="without_start_token_complete_reasoning_stream",
|
||||
),
|
||||
pytest.param(
|
||||
False,
|
||||
WITH_THINK,
|
||||
id="with_think",
|
||||
),
|
||||
pytest.param(
|
||||
True,
|
||||
WITH_THINK_STREAM,
|
||||
id="with_think_stream",
|
||||
),
|
||||
pytest.param(
|
||||
False,
|
||||
WITHOUT_THINK,
|
||||
|
||||
Reference in New Issue
Block a user