Migra el ajuste de la API de PaLM a la API de Gemini

Los modelos de Gemini y PaLM admiten diferentes formatos de datos de ajuste. Para comprender los detalles sobre el formato de datos del ajuste de modelos de Gemini, consulta Formato del conjunto de datos.

Para comprender cómo migrar de los modelos de texto de PaLM a un modelo de texto de Gemini, consulta los siguientes ejemplos.

Convierte text-bison en Gemini

En el siguiente ejemplo, se muestra cómo convertir un conjunto de datos de texto-bison en un conjunto de datos de Gemini. Este ejemplo se expande para que puedas comprender el formato.

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"
}

En el siguiente ejemplo, se proporciona el mismo contenido en el ejemplo anterior, pero en un formato JSONL listo para usar para el ajuste.

{"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

El siguiente ejemplo muestra el mismo contenido en el ejemplo de text-bison anterior, pero en formato de Gemini. Este ejemplo se expande para que puedas comprender el formato.

{
  "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"
    }
  ]
}

En el siguiente ejemplo, se proporciona el mismo contenido que en el ejemplo anterior, pero en un formato JSONL listo para usar para el ajuste.

{"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"}]}

Convierte chat-bison en Gemini

En el siguiente ejemplo, se muestra cómo convertir un conjunto de datos de chat-bison, pero en formato de Gemini. Este ejemplo se expande para que puedas comprender el formato.

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."
    }
  ]
}

En el siguiente ejemplo, se proporciona el mismo contenido que en el ejemplo anterior, pero en un formato JSONL listo para usar para el ajuste.

{"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

En el siguiente ejemplo, se muestra el mismo contenido en el ejemplo de chat-bison anterior, pero en formato de Gemini. Este ejemplo se expande para que puedas comprender el formato.

{
  "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."
    }
  ]
}

En el siguiente ejemplo, se proporciona el mismo contenido que en el ejemplo anterior, pero en un formato JSONL listo para usar para el ajuste.

{"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."}]}

¿Qué sigue?