用于调整基础模型的数据格式

准备一组用于调整模型的提示示例。 这些示例必须包含模型在运行时将需要处理的输入类型以及模型要在响应中生成的相应输出。

您可以从一个文件或一个已连接的数据存储器添加训练数据。

要使用外部数据存储器中的训练数据,必须首先设置与数据存储器的连接。 支持以下已连接的数据存储器:

培训数据需求

创建训练数据时,请遵循以下准则:

  • 添加 100 到 1 000 个标注示例。

    你可以使用无限数量的示例。 然而,最多只能从连接的数据存储中添加10,000个示例。 您上传的包含示例的JSON或JSONL文件大小不得超过200 MB。

  • 训练数据的语言必须是基础模型所支持的语言。

    请注意,"input和 "output标签必须继续使用英文。

  • 将输入和输出示例保持在试验所使用的最大令牌限制内。 否则,将截断示例文本。 有关更多信息,请参阅设置微调令牌限制

    令牌的计数方式因模型而异,这使令牌的数量难以估计。 对于基于语言的基础模型,可将256个令牌视为约130—170个单词,128个令牌则相当于约65—85个单词。 有关更多信息,请参阅 令牌和记号化

如果计划使用调整后的基础模型对数据进行分类,请遵循以下额外准则:

  • 尝试将类标签数限制为 10 或更少。
  • 包含相同数量的每个类类型的示例。

您可以使用 Prompt Lab 为训练数据制作示例。 更多信息,请参见 Prompt Lab.

收集一组具有代表性的示例后,请将这些示例分组到一个集合中以用于训练,并将另一个较小的集合用于测试目的。

文件格式要求

训练数据文件必须满足以下要求:

  • 使用下列其中一种格式:
    • JavaScript 对象表示法 (JSON)
    • JSON 行 (JSONL) 格式
  • 允许的最大文件大小为 200 MB。
  • 每个示例都必须包含一个 inputoutput 对。
  • 如果输入或输出文本包含引号,请使用反斜杠 (\) 对每个引号进行转义。 例如, He said, \"Yes.\"
  • 要表示回车符或换行符,可以使用 \n 转义序列来表示换行符。 例如, ...end of paragraph.\nStart of new paragraph

JSON 示例

以下示例显示了来自训练数据文件的摘录,其中标注了 JSON 格式的分类任务提示。

[
  {
    "input":"Message: When I try to log in, I get an error.",
    "output":"Class name: Problem"
  },
  {
  "input":"Message: Where can I find the plan prices?",
  "output":"Class name: Question"
  },
  {
    "input":"Message: What is the difference between trial and paygo?",
    "output":"Class name: Question"
  },
  {
    "input":"Message: The registration page crashed, and now I can't create a new account.",
    "output":"Class name: Problem"
  },
  {
    "input":"Message: What regions are supported?",
    "output":"Class name: Question"
  },
  {
    "input":"Message: I can't remember my password.",
    "output":"Class name: Problem"
  },
  {
    "input":"Message: I'm having trouble registering for a new account.",
    "output":"Classname: Problem"
  },
  {
    "input":"Message: A teammate shared a service instance with me, but I can't access it. What's wrong?",
    "output":"Class name: Problem"
  },
  {
    "input":"Message: What extra privileges does an administrator have?",
    "output":"Class name: Question"
  },
  {
    "input":"Message: Can I create a service instance for data in a language other than English?",
    "output":"Class name: Question"
  }
]

JSONL 示例

以下示例显示了训练数据文件中的摘录,其中标注了 JSONL 格式的分类任务提示。

{"input":"Message: When I try to log in, I get an error.","output":"Class name: Problem"}
{"input":"Message: Where can I find the plan prices?","output":"Class name: Question"}
{"input":"Message: What is the difference between trial and paygo?","output":"Class name: Question"}
{"input":"Message: The registration page crashed, and now I can't create a new account.","output":"Class name: Problem"}
{"input":"Message: What regions are supported?","output":"Class name: Question"}
{"input":"Message: I can't remember my password.","output":"Class name: Problem"}
{"input":"Message: I'm having trouble registering for a new account.","output":"Classname: Problem"}
{"input":"Message: A teammate shared a service instance with me, but I can't access it. What's wrong?","output":"Class name: Problem"}
{"input":"Message: What extra privileges does an administrator have?","output":"Class name: Question"}
{"input":"Message: Can I create a service instance for data in a language other than English?","output":"Class name: Question"}

表格数据格式要求

您可以直接从已连接的数据源添加数据,也可以从使用已连接的数据源中的数据创建的数据资产添加数据。

数据的格式必须如下所示:

  • 从表格数据库 (例如 Presto 或 watsonx.data) 中选择数据时,该表必须具有两个具有标题名称 inputoutput的列。 列标题名称必须为小写。 例如,将忽略名为 InputINPUT的列。 该表可以包含更多列,但是将忽略任何额外的列。
限制:请记住,从一个连接的数据源最多可添加 10,000 个输入输出示例对。 如果外部数据源包含更多示例,那么将发生错误,并且调整试验将无法成功运行。

表格数据示例

下表说明了如何构造带有分类任务的带标签提示的训练数据。

表 1. 表格训练数据示例
输入 输出
消息: 当我尝试登录时,我收到一个错误。 类名: 问题
消息: 在哪里可以找到套餐价格? 类名: 问题
消息: 试用版和付费版有什么区别? 类名: 问题
消息: 注册页面崩溃了,现在我无法创建新帐户。 类名: 问题
消息: 支持哪些区域? 类名: 问题
消息: 我无法记住我的密码。 类名: 问题
消息: 注册新帐户时迂到问题。 类名: 问题
消息: 一个队友与我共享了一个服务实例,但我无法访问它。 怎么了 类名: 问题
消息: 管理员具有哪些额外特权? 类名: 问题
消息: 可以使用英语以外的语言为数据创建服务实例吗? 类名: 问题