CogAgent uses a specific conversation format for multi-turn fine-tuning. The data should be organized in a JSON format where each entry contains a messages list.
Key requirements:
- Role-based loss masking: Different roles are assigned different
loss_mask values to calculate loss for multi-turn responses in a single pass. - Image requirement: Every data entry must include an
image path. - History steps: For the
cogagent-9b-20241220 model, the user role's content must include a History steps: section containing all previous operations in the sequence. - Termination:
- Intermediate steps should return
<<一般操作>> (General Operation). - The final step in a complete process should return
<<END>>.
Example structure:
{
"messages": [
{
"role": "user",
"content": "Task: ...\nHistory steps: \n0. CLICK(...) ...",
"image": "images/0000000000336.png"
},
{
"role": "assistant",
"content": "Action: ...\nGrounded Operation:CLICK(...)\n<<一般操作>>"
}
]
}
{
"messages": [
{
"role": "user",
"content": "Task: 在系统设置的桌面与程序坞部分,开启调度中心板块中“显示器具有单独空间”的选项\n(Platform: Mac)\n(Answer in Action-Operation-Sensitive format.)\nHistory steps: \n0. CLICK(box=[[588,946,616,985]], element_info='系统设置')\t点击屏幕下方的“系统设置”菜单,从而打开系统设置\n1. CLICK(box=[[227,561,297,585]], element_info='桌面与程序坞')\t点击左侧菜单中的“桌面与程序坞”选项,进入桌面与程序坞的设置界面.\n2. SCROLL_DOWN(box=[[367,39,691,929]], step_count=75, element_info='滚动')\t在当前屏幕的右侧滚动区域中,向下滚动以查看更多选项.\n",
"image": "images/0000000000336.png"
},
{
"role": "assistant",
"content": "Action: 点击“调度中心”板块中的“显示器具有单独空间”选项,从而开启该功能.\nGrounded Operation:CLICK(box=[[655,842,671,857]], element_info='“显示器具有单独空间”的开关按钮')\n<<一般操作>>"
}
]
}