diff --git a/fastdeploy/input/ernie4_5_vl_processor/ernie4_5_vl_processor.py b/fastdeploy/input/ernie4_5_vl_processor/ernie4_5_vl_processor.py index 317980038..862709757 100644 --- a/fastdeploy/input/ernie4_5_vl_processor/ernie4_5_vl_processor.py +++ b/fastdeploy/input/ernie4_5_vl_processor/ernie4_5_vl_processor.py @@ -233,7 +233,7 @@ class Ernie4_5_VLProcessor(Ernie4_5Processor): if chat_template_kwargs: if isinstance(chat_template_kwargs, dict): for k, v in chat_template_kwargs.items(): - if k not in request: + if k not in request or request[k] is None: request[k] = v else: raise ValueError("Invalid input: chat_template_kwargs must be a dict") diff --git a/fastdeploy/input/qwen_vl_processor/qwen_vl_processor.py b/fastdeploy/input/qwen_vl_processor/qwen_vl_processor.py index cc649c9ba..06f43f335 100644 --- a/fastdeploy/input/qwen_vl_processor/qwen_vl_processor.py +++ b/fastdeploy/input/qwen_vl_processor/qwen_vl_processor.py @@ -237,7 +237,7 @@ class QwenVLProcessor(TextProcessor): if chat_template_kwargs: if isinstance(chat_template_kwargs, dict): for k, v in chat_template_kwargs.items(): - if k not in request: + if k not in request or request[k] is None: request[k] = v else: raise ValueError("Invalid input: chat_template_kwargs must be a dict") diff --git a/tests/input/test_qwen_vl_processor.py b/tests/input/test_qwen_vl_processor.py index a6db80cde..083f7017c 100644 --- a/tests/input/test_qwen_vl_processor.py +++ b/tests/input/test_qwen_vl_processor.py @@ -204,6 +204,26 @@ class TestQwenVLProcessor(unittest.TestCase): result["multimodal_inputs"]["image_type_ids"].shape[0], result["multimodal_inputs"]["grid_thw"][:, 0].sum() ) + def test_process_request_dict_enable_thinking(self): + num_completion_token_ids = 10 + request = { + "request_id": "12345", + "completion_token_ids": [1] * num_completion_token_ids, + "stop": ["stop", "eof"], + "messages": [ + { + "role": "user", + "content": [ + {"type": "text", "text": "Hello"}, + ], + } + ], + "chat_template_kwargs": {"enable_thinking": True}, + } + + result = self.processor.process_request_dict(request, 100) + self.assertEqual(result.get("enable_thinking"), False) + def test_prompt(self): """ Test processing of prompt with image and video placeholders