admin 管理员组

文章数量: 887016

ChatGPT开放了API调用,让我们来一起看一下他们家的API服务框架文档。

声明:
在接下来的文档中,我会将OpenAI简称为OA,prompt称为模板,Fine-tune称为微调。

调用过程三步走

1.准备你自己的微调数据
2.开始微调训练
3.开始调用微调模型进行预测

样例1 :基于维基百科写广告推文

输入模板:

{"prompt":"<Product Name>\n<Wikipedia description>\n\n###\n\n", "completion":" <engaging ad> END"}

“prompt”:

“Samsung Galaxy Feel\nThe Samsung Galaxy Feel is an Android smartphone developed by Samsung Electronics exclusively for the Japanese market. The phone was released in June 2017 and was sold by NTT Docomo. It runs on Android 7.0 (Nougat), has a 4.7 inch display, and a 3000 mAh battery.\nSoftware\nSamsung Galaxy Feel runs on Android 7.0 (Nougat), but can be later updated to Android 8.0 (Oreo).\nHardware\nSamsung Galaxy Feel has a 4.7 inch Super AMOLED HD display, 16 MP back facing and 5 MP front facing cameras. It has a 3000 mAh battery, a 1.6 GHz Octa-Core ARM Cortex-A53 CPU, and an ARM Mali-T830 MP1 700 MHz GPU. It comes with 32GB of internal storage, expandable to 256GB via microSD. Aside from its software and hardware specifications, Samsung also introduced a unique a hole in the phone’s shell to accommodate the Japanese perceived penchant for personalizing their mobile phones. The Galaxy Feel’s battery was also touted as a major selling point since the market favors handsets with longer battery life. The device is also waterproof and supports 1seg digital broadcasts using an antenna that is sold separately.\n\n###\n\n”

“completion”:

"Looking for a smartphone that can do it all? Look no further than Samsung Galaxy Feel! With a slim and sleek design, our latest smartphone features high-quality picture and video capabilities, as well as an award winning battery life.

格式

正如上述给出的样例,你的格式需要满足json语法结构,成形JSONL文件。注意这里是JsonLine.

{"prompt": "<prompt text>", "completion": "<ideal generated text>"}
{"prompt": "<prompt text>", "completion": "<ideal generated text>"}
{"prompt": "<prompt text>", "completion": "<ideal generated text>"}
...

文档中也提到了一些细节格式要求:

  1. prompt的结尾要用 \n\n###\n\n 来结束
  2. prompt的开头需要有一个英文空格。
  3. p+c构成的整条样例,包括一些标识字符,不要超过2048tokens.
  4. 分类样本推荐每个类别100个样本,可用logprob来配置类别数量。
  5. 保证你的训练数据 在格式上和任务类型上 都尽可能接近你的真正应用场景。

方法

如何上传file到finetune服务器,需要查看documentation的file章节

TODO

接下来就是搞些质量数据,实践一下了,有后续再更新吧。

本文标签: 随笔 文档 技巧 ChatGpt OpenAI