gpt4 book ai didi

Trouble with formatting dataset for OpenAI(设置OpenAI数据集的格式时遇到问题)

转载 作者:bug小助手 更新时间:2023-10-28 09:37:54 25 4
gpt4 key购买 nike



Trying to feed regular json files into the curl command, surely enough, gives an error:

尝试将常规的json文件提供给curl命令时,肯定会出现错误:


curl https://api.openai.com/v1/files \
-H "Authorization: Bearer [key]" \
-F "purpose=fine-tune" \
-F "file=@./formatted_dataset.json"
{
"error": {
"message": "Expected file to have JSONL format, where every line is a valid JSON dictionary. Line 1 is not a dictionary (HINT: line starts with: \"{...\").",
"type": "invalid_request_error",
"param": null,
"code": null
}
}

Here is the data:

以下是数据:


{
"messages": [
{
"role":"system",
"content":"You are a friendly bot named docky with the experience of a well seasoned medical professional. Your job is to answer both to medical students using appropriate terminology, and regular people inquiring about their medical problems. You are not afraid to give advice."
},
{
"role":"user",
"content":"Is the protein Papilin secreted?"
},
{
"role":"assistant",
"content":"Yes, papilin is a secreted protein."
}
]
}

So I tried using jq to format my data: jq -c '.[]' formatted_dataset.json >> output.jsonl

所以我试着用jq来格式化我的数据:jq -c '。[]'formatted_jsonet.json>> output.jsonl


...this being the output:

...这是输出:


[{"role":"system","content":"You are a friendly bot named docky with the experience of a well seasoned medical professional. Your job is to answer both to medical students using appropriate terminology, and regular people inquiring about their medical problems. You are not afraid to give advice."},{"role":"user","content":"Is the protein Papilin secreted?"},{"role":"assistant","content":"Yes, papilin is a secreted protein."}]

But the error prevails:

但错误占了上风:


{
"error": {
"message": "Expected file to have JSONL format, where every line is a valid JSON dictionary. Line 1 is not a dictionary (HINT: line starts with: \"[{\"r...\").",
"type": "invalid_request_error",
"param": null,
"code": null
}
}

更多回答
优秀答案推荐
更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com