mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-31 00:36:20 +08:00
Merge 5d389ab4599996b1f2a8651b06f54b2f15537b53 into 553741557a57df44a46fb3ab72b6aafeaf945337
This commit is contained in:
commit
416bc1da1a
@ -119,15 +119,20 @@ class LLM:
|
||||
if isinstance(prompts, str):
|
||||
# Convert a single prompt to a list.
|
||||
prompts = [prompts]
|
||||
if isinstance(multi_modal_data, dict):
|
||||
multi_modal_data = [multi_modal_data]
|
||||
if prompts is not None and prompt_token_ids is not None and len(prompts) != len(prompt_token_ids):
|
||||
raise ValueError("The lengths of prompts and prompt_token_ids must be the same.")
|
||||
num_requests = len(prompts) if prompts is not None else len(prompt_token_ids)
|
||||
if multi_modal_data is not None and len(multi_modal_data) != num_requests:
|
||||
raise ValueError("The lengths of prompts and multi_modal_data must be the same.")
|
||||
if isinstance(sampling_params, list) and len(sampling_params) != num_requests:
|
||||
raise ValueError("The lengths of prompts and sampling_params must be the same.")
|
||||
if sampling_params is None:
|
||||
# Use default sampling params.
|
||||
sampling_params = SamplingParams()
|
||||
|
||||
# Add requests to the engine.
|
||||
num_requests = len(prompts) if prompts is not None else len(prompt_token_ids)
|
||||
for i in range(num_requests):
|
||||
prompt = prompts[i] if prompts is not None else None
|
||||
token_ids = None if prompt_token_ids is None else prompt_token_ids[i]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user