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