fix mulitple <image>

This commit is contained in:
2025-08-14 08:35:10 +00:00
parent 8d781d68df
commit c35a1621b2

View File

@@ -191,7 +191,7 @@ def generate_vqa_conversations(
"role": "user",
# The content is the list of image dicts, followed by the text dict
"content": image_content_list
+ [{"type": "text", "text": "<image>" + question_text}],
+ [{"type": "text", "text": "<image>" * len(found_image_paths) + question_text}],
}
assistant_message = {"role": "assistant", "content": answer_text}
@@ -276,7 +276,7 @@ def generate_multiturn_conversations(
first_question = random.choice(question_bank[main_field][language])
conversation.append({
"role": "user",
"content": image_content_list + [{"type": "text", "text": "<image>" + first_question}],
"content": image_content_list + [{"type": "text", "text": "<image>" * len(found_image_paths) + first_question}],
})
# 3. First Assistant Turn
@@ -363,7 +363,7 @@ def generate_vq_question(
user_message = {
"role": "user",
"content": image_content_list
+ [{"type": "text", "text": "<image>" + question_text}],
+ [{"type": "text", "text": "<image>" * len(image_paths) + question_text}],
}
conversation = [system_message, user_message]
final_conversations.append(conversation)
@@ -430,7 +430,7 @@ def generate_multiturn_vq_question(
first_question = random.choice(question_bank[main_field][language])
conversation.append({
"role": "user",
"content": image_content_list + [{"type": "text", "text": "<image>" + first_question}],
"content": image_content_list + [{"type": "text", "text": "<image>" * len(image_paths) + first_question}],
})
# 3. Follow-up User Turns (text only)