Commit 9736caa9 authored by 王敏's avatar 王敏
Browse files

[fix]回退test_long_context中限制输入长度修改

parent fa57cb7f
...@@ -81,9 +81,6 @@ def generate( ...@@ -81,9 +81,6 @@ def generate(
inputs: Tuple[str, SamplingParams, Optional[LoRARequest]], inputs: Tuple[str, SamplingParams, Optional[LoRARequest]],
): ):
prompts, sampling_param, lora_request = inputs prompts, sampling_param, lora_request = inputs
max_model_len = llm.llm_engine.model_config.max_model_len
if len(prompts) >= max_model_len:
prompts = prompts[:max_model_len-1]
outputs = llm.generate(prompts, sampling_param, lora_request=lora_request) outputs = llm.generate(prompts, sampling_param, lora_request=lora_request)
return outputs[0].outputs[0].text.strip() return outputs[0].outputs[0].text.strip()
...@@ -92,11 +89,8 @@ def batched_generate( ...@@ -92,11 +89,8 @@ def batched_generate(
llm: vllm.LLM, llm: vllm.LLM,
inputs: List[Tuple[str, SamplingParams, Optional[LoRARequest]]], inputs: List[Tuple[str, SamplingParams, Optional[LoRARequest]]],
): ):
max_model_len = llm.llm_engine.model_config.max_model_len
for input in inputs: for input in inputs:
prompt, sampling_param, lora_req = input prompt, sampling_param, lora_req = input
if len(prompt) >= max_model_len:
prompt = prompt[:max_model_len-1]
# Add requests to the engine and run the engine # Add requests to the engine and run the engine
llm._validate_and_add_requests(prompt, llm._validate_and_add_requests(prompt,
sampling_param, sampling_param,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment