Update multiprocess_inference.py
Browse files
multiprocess_inference.py
CHANGED
@@ -192,12 +192,12 @@ How many people are in {{./test.jpg}}?
|
|
192 |
|
193 |
img_path = img_match.group(1)
|
194 |
# 将图片标记替换为<image>标记
|
|
|
195 |
prompt = f"""<|im_start|>system
|
196 |
You are a helpful assistant.<|im_end|>
|
197 |
<|im_start|>user
|
198 |
-
{full_input.replace(img_match.group(0),
|
199 |
<|im_start|>assistant
|
200 |
-
|
201 |
"""
|
202 |
img_path_queue.put(img_path)
|
203 |
prompt_queue.put(prompt)
|
|
|
192 |
|
193 |
img_path = img_match.group(1)
|
194 |
# 将图片标记替换为<image>标记
|
195 |
+
image_placeholder = '<image_id>0</image_id><image>\n' # 先定义替换文本
|
196 |
prompt = f"""<|im_start|>system
|
197 |
You are a helpful assistant.<|im_end|>
|
198 |
<|im_start|>user
|
199 |
+
{full_input.replace(img_match.group(0), image_placeholder)}<|im_end|>
|
200 |
<|im_start|>assistant
|
|
|
201 |
"""
|
202 |
img_path_queue.put(img_path)
|
203 |
prompt_queue.put(prompt)
|