in src/open-r1-multimodal/src/open_r1/sft.py [0:0]
def __getitem__(self, i):
# Format into conversation
def make_conversation_image(example):
image_root = self.script_args.image_root
# print(111, image_root)
# print(222, example['image'])
image_path = os.path.join(image_root, example['image'])
x1, y1, x2, y2 = example["solution"]
normal_caption = example["normal_caption"]
return [
{
"role": "user",
"content": [
{"type": "image", "image": f"file://{image_path}"},
{"type": "text", "text": example["problem"]},
],
},
{
"role": "assistant",
"content": f'```json\n[\n\t{{"bbox_2d": [{int(x1)}, {int(y1)}, {int(x2)}, {int(y2)}], "label": "{normal_caption}"}}\n]\n```',
}
]
example = self.list_data_dict[i]
example["messages"] = make_conversation_image(example)
return example