小编dno*_*obl的帖子

如何在 GPT-3 上保存预训练的 API?

我有一个关于 GPT-3 的问题。正如我们所知,我们可以给网络提供一些例子并“调整”模型。

  1. 向模型展示示例。
  2. 保存这些示例。
  3. 重用 API。

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 …
Run Code Online (Sandbox Code Playgroud)

python gpt-3

5
推荐指数
1
解决办法
886
查看次数

标签 统计

gpt-3 ×1

python ×1