Skip to content

Chat template not applied for vllm models #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tim-Siu opened this issue Feb 19, 2025 · 0 comments
Open

Chat template not applied for vllm models #1

Tim-Siu opened this issue Feb 19, 2025 · 0 comments

Comments

@Tim-Siu
Copy link

Tim-Siu commented Feb 19, 2025

It seems that if we run run eval_kk.py with argument use_vllm, the script will fedd raw prompt to vllm, without applying chat template like <|im_start|>...

mem-kk-logic/utils.py

Lines 25 to 48 in 1022068

def batch_decode_vllm(llm, prompts, batch_size=32):
"""
Perform batch decoding using vLLM.
Args:
- llm: The vLLM model instance
- prompts: List of prompts to process
- batch_size: Number of prompts to process in each batch
Returns:
- List of generated responses
"""
from vllm import SamplingParams # type: ignore
all_responses = []
for i in range(0, len(prompts), batch_size):
batch_prompts = prompts[i : i + batch_size]
sampling_params = SamplingParams(max_tokens=llm.max_tokens, temperature=0)
outputs = llm.model.generate(
batch_prompts, sampling_params
)
responses = [output.outputs[0].text for output in outputs]
all_responses.extend(responses)
return all_responses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant