GPT3 completion with insertion – invalid argument :suffix

我在尝试使用插入的方式进行补全。

似乎我应该使用一个名为suffix:的参数来指示插入的结束位置。

enter image description here

发送到端点的负载: POST /v1/completions

{  "model": "code-davinci-002",  "prompt": "Write a JSON document for a person with first name, last name, email and phone number\n\n{\n",  "suffix": "\n}",  "temperature": 0,  "max_tokens": 256,  "top_p": 1,  "frequency_penalty": 0,  "presence_penalty": 0}

我尝试从一个Ruby实现的GPT3中进行操作。

parameters=> {:model=>"code-davinci-001", :prompt=>"generate some JSON for a person with first and last name {", :max_tokens=>250, :temperature=>0, :top_p=>1, :frequency_penalty=>0, :presence_penalty=>0, :suffix=>"\n}"}
post(url: "/v1/completions", parameters: parameters)

我收到了关于suffix的无效参数错误

{"error"=>{"message"=>"Unrecognized request argument supplied: suffix", "type"=>"invalid_request_error", "param"=>nil, "code"=>nil}}

回答:

我对比了来自OpenAI的负载和Ruby库的负载,发现了问题所在。

我的Ruby库将模型设置为code-davinci-001,而OpenAI使用的是code-davinci-002

一旦我在调试中手动更改了模型属性,补全就开始正常工作了。

{  "id"=>"cmpl-5yJ8b01Cw26W6ZIHoRSOb71Dc4QvH",  "object"=>"text_completion",  "created"=>1665054929,  "model"=>"code-davinci-002",  "choices"=>  [{"text"=>"\n    \"firstName\": \"John\",\n    \"lastName\": \"Smith\"",    "index"=>0,    "logprobs"=>nil,    "finish_reason"=>"stop"}],  "usage"=>{"prompt_tokens"=>14, "completion_tokens"=>19,  "total_tokens"=>33}}

Related Posts

L1-L2正则化的不同系数

我想对网络的权重同时应用L1和L2正则化。然而,我找不…

使用scikit-learn的无监督方法将列表分类成不同组别,有没有办法?

我有一系列实例,每个实例都有一份列表,代表它所遵循的不…

f1_score metric in lightgbm

我想使用自定义指标f1_score来训练一个lgb模型…

通过相关系数矩阵进行特征选择

我在测试不同的算法时,如逻辑回归、高斯朴素贝叶斯、随机…

可以将机器学习库用于流式输入和输出吗?

已关闭。此问题需要更加聚焦。目前不接受回答。 想要改进…

在TensorFlow中,queue.dequeue_up_to()方法的用途是什么?

我对这个方法感到非常困惑,特别是当我发现这个令人费解的…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注