我有个关于GPT-3的问题。如我们所知,我们可以给网络提供一些例子,并“调整”模型。
examples.
import openai
class Example():
"""Stores an input, output pair and formats it to prime the model."""
def __init__(self, inp, out):
self.input = inp
self.output = out
def get_input(self):
"""Returns the input of the example."""
return self.input
def get_output(self):
"""Returns the intended output of the example."""
return self.output
def format(self):
"""Formats the input, output pair."""
return f"input: {self.input}\noutput: {self.output}\n"
class GPT:
"""The main class for a user to interface with the OpenAI API.
A user can add examples and set parameters of the API request."""
def __init__(self, engine='davinci',
temperature=0.5,
max_tokens=100):
self.examples = []
self.engine = engine
self.temperature = temperature
self.max_tokens = max_tokens
def add_example(self, ex):
"""Adds an example to the object. Example must be an instance
of the Example class."""
assert isinstance(ex, Example), "Please create an Example object."
self.examples.append(ex.format())现在,当我对模型使用“给予”示例时,我有以下代码:
gpt2 = GPT(engine="davinci", temperature=0.5, max_tokens=100)
gpt2.add_example(Example('Two plus two equals four', '2 + 2 = 4'))
gpt2.add_example(Example('The integral from zero to infinity', '\\int_0^{\\infty}'))
prompt1 = "x squared plus y squared plus equals z squared"
output1 = gpt2.submit_request(prompt1)然而,我无法保存这个“预培训”API.每次我要重新训练它的时候-有什么方法可以重用它吗?
发布于 2021-05-22 20:19:07
每次我必须重新训练它的时候,
--有什么方法可以重用它吗?
不,没有任何方法可以重用它。你混淆了术语:你不需要训练GPT-3,你需要把例子传递给提示符。由于您没有任何类型的容器可以存储以前的结果(从而“培训”您的模型),所以每次都需要传递包含任务的示例。
完善工程过程(从而降低每项要求的成本)是一个困难的过程,将需要很长的时间来反复试验。
不过,让我们诚实地说:即使每次都通过这些例子,GPT-3仍然是极具成本效益的。根据您的具体情况,您(平均)只需要花费几百个令牌来完成与Davinci的复杂完成。
https://stackoverflow.com/questions/67325687
复制相似问题