[Bugfix] Fix phi3v incorrect image_idx when using async engine (#7916)

This commit is contained in:
Isotr0py 2024-08-28 01:36:09 +08:00 committed by GitHub
parent 42e932c7d4
commit b09c755be8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -422,7 +422,9 @@ def input_processor_for_phi3v(ctx: InputContext, llm_inputs: LLMInputs):
prompt = llm_inputs.get("prompt")
if prompt is None:
image_idx = []
# for async server request, we assume prompt and its token_ids is always
# in correct format. And num_image_tags == len(image_data) always True.
image_idx = range(1, len(image_data) + 1)
new_prompt = None
else:
image_idx = sorted(map(int, re.findall(r"<\|image_(\d+)\|>+", prompt)))