|
18 | 18 | VllmConfig, |
19 | 19 | set_current_vllm_config, |
20 | 20 | ) |
| 21 | +from vllm.config.reasoning import ReasoningConfig |
21 | 22 | from vllm.distributed.parallel_state import ( |
22 | 23 | init_distributed_environment, |
23 | 24 | initialize_model_parallel, |
@@ -255,6 +256,31 @@ def test_select_common_block_size_uses_largest_shared_int(): |
255 | 256 | assert selected_size == 64 |
256 | 257 |
|
257 | 258 |
|
| 259 | +def test_reasoning_config_without_custom_logitsprocs_does_not_need_output_token_ids( |
| 260 | + dist_init, |
| 261 | +): |
| 262 | + vllm_config = get_vllm_config() |
| 263 | + assert vllm_config.model_config.logits_processors is None |
| 264 | + reasoning_config = ReasoningConfig( |
| 265 | + reasoning_start_str="<think>", reasoning_end_str="</think>" |
| 266 | + ) |
| 267 | + reasoning_config._reasoning_start_token_ids = [1] |
| 268 | + reasoning_config._reasoning_end_token_ids = [2] |
| 269 | + vllm_config.reasoning_config = reasoning_config |
| 270 | + |
| 271 | + with set_current_vllm_config(vllm_config): |
| 272 | + model_config = vllm_config.model_config |
| 273 | + num_heads = model_config.get_num_kv_heads(vllm_config.parallel_config) |
| 274 | + head_size = model_config.get_head_size() |
| 275 | + vllm_config.compilation_config.static_forward_context["layer.0"] = Attention( |
| 276 | + num_heads, head_size, 0.1 |
| 277 | + ) |
| 278 | + runner = GPUModelRunner(vllm_config, torch.device("cpu")) |
| 279 | + |
| 280 | + assert runner.input_batch.thinking_budget_state_holder is not None |
| 281 | + assert runner.input_batch.logitsprocs_need_output_token_ids is False |
| 282 | + |
| 283 | + |
258 | 284 | @pytest.mark.skip_global_cleanup |
259 | 285 | @pytest.mark.parametrize( |
260 | 286 | ("world_size", "is_last_rank", "expected_calls"), |
|
0 commit comments