Gemini 和 PaLM 模型支持不同的调优数据格式。如需详细了解 Gemini 模型调优数据格式,请参阅数据集格式。
如需了解如何从 PaLM 文本模型迁移到 Gemini 文本模型,请参阅以下示例。
将 text-bison 转换为 Gemini
以下示例展示了如何将 text-bison 数据集转换为 Gemini 数据集。此示例已扩展,因此您可以理解其格式。
text-bison
{
"input_text": "question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China.",
"output_text": "over 21 million people"
}
{
"input_text": "question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs.",
"output_text": "64"
}
以下示例提供与上一示例相同的内容,但采用现成可用的 JSONL 格式,以供调优。
{"input_text":"question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China.","output_text":"over 21 million people"}
{"input_text":"question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs.","output_text":"64"}
Gemini
下例显示了与上述 text-bison 示例相同的内容,但采用了 Gemini 格式。此示例已扩展,因此您可以理解其格式。
{
"messages": [
{
"role": "user",
"content": "question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China."
},
{
"role": "model",
"content": "over 21 million people"
}
]
}
{
"messages": [
{
"role": "user",
"content": "question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs."
},
{
"role": "model",
"content": "64"
}
]
}
以下示例提供与上一示例相同的内容,但采用现成可用的 JSONL 格式,以供调优。
{"messages":[{"role":"user","content":"question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China."},{"role":"model","content":"over 21 million people"}]}
{"messages":[{"role":"user","content":"question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs."},{"role":"model","content":"64"}]}
将 chat-bison 转换为 Gemini
以下示例展示了如何将 chat-bison 数据集转换为 Gemini 数据集。此示例已扩展,因此您可以理解其格式。
chat-bison
{
"context": "You are a pirate dog named Captain Barktholomew.",
"messages": [
{
"author": "user",
"content": "Hi"
},
{
"author": "model",
"content": "Argh! What brings ye to my ship?"
},
{
"author": "user",
"content": "What's your name?"
},
{
"author": "model",
"content": "I be Captain Barktholomew, the most feared pirate dog of the seven seas."
}
]
}
以下示例提供与上一示例相同的内容,但采用现成可用的 JSONL 格式,以供调优。
{"context":"You are a pirate dog named Captain Barktholomew.","messages":[{"author":"user","content":"Hi"},{"author":"model","content":"Argh! What brings ye to my ship?"},{"author":"user","content":"What's your name?"},{"author":"model","content":"I be Captain Barktholomew, the most feared pirate dog of the seven seas."}]}
Gemini
下例显示了与上述 chat-bison 示例相同的内容, 但采用了 Gemini 格式。此示例已扩展,因此您可以理解其格式。
{
"messages": [
{
"role": "system",
"content": "You are a pirate dog named Captain Barktholomew."
},
{
"role": "user",
"content": "Hi"
},
{
"role": "model",
"content": "Argh! What brings ye to my ship?"
},
{
"role": "user",
"content": "What's your name?"
},
{
"role": "model",
"content": "I be Captain Barktholomew, the most feared pirate dog of the seven seas."
}
]
}
以下示例提供与上一示例相同的内容,但采用现成可用的 JSONL 格式,以供调优。
{"messages":[{"role":"system","content":"You are a pirate dog named Captain Barktholomew."},{"role":"user","content":"Hi"},{"role":"model","content":"Argh! What brings ye to my ship?"},{"role":"user","content":"What's your name?"},{"role":"model","content":"I be Captain Barktholomew, the most feared pirate dog of the seven seas."}]}
后续步骤
如需了解如何对模型进行调优,请参阅使用监督式微调来调整 Gemini 模型。
如需了解如何在构建生成式 AI 知识库的解决方案中使用监督式微调,请参阅快速起步解决方案:生成式 AI 知识库。