Chat Template
This commit is contained in:
+10
-2
@@ -5,14 +5,22 @@ from utils import validate_and_convert_sampling_params, initialize_llm_engine, S
|
||||
from vllm.utils import random_uuid
|
||||
|
||||
serverless_config = ServerlessConfig()
|
||||
llm = initialize_llm_engine()
|
||||
llm, tokenizer = initialize_llm_engine()
|
||||
|
||||
def concurrency_modifier(current_concurrency) -> int:
|
||||
return max(0, serverless_config.max_concurrency - current_concurrency)
|
||||
|
||||
async def handler(job: dict) -> Generator[dict, None, None]:
|
||||
job_input = job["input"]
|
||||
prompt = job_input["prompt"]
|
||||
prompt = job_input.get("prompt")
|
||||
apply_chat_template = job_input.get("apply_chat_template", False)
|
||||
messages = job_input.get("messages")
|
||||
|
||||
if messages:
|
||||
prompt = tokenizer.apply_chat_template(messages)
|
||||
elif apply_chat_template:
|
||||
prompt = tokenizer.apply_chat_template(prompt)
|
||||
|
||||
streaming = job_input.get("streaming", False)
|
||||
batch_size = job_input.get("batch_size", serverless_config.default_batch_size)
|
||||
sampling_params = job_input.get("sampling_params", {})
|
||||
|
||||
Reference in New Issue
Block a user