Abstimmung von der PaLM API zur Gemini API migrieren

Gemini- und PaLM-Modelle unterstützen verschiedene Abstimmungsdatenformate. Weitere Informationen zum Datenformat der Modellabstimmung mit Gemini finden Sie unter Dataset-Format.

In den folgenden Beispielen erfahren Sie, wie Sie von den PaLM-Textmodellen zu einem Gemini-Textmodell migrieren.

text-bison in Gemini konvertieren

Das folgende Beispiel zeigt, wie ein text-bison-Dataset in ein Gemini-Dataset konvertiert wird. Dieses Beispiel ist erweitert, damit Sie das Format verstehen.

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

Im folgenden Beispiel wird der gleiche Inhalt im vorherigen Beispiel bereitgestellt, jedoch in einem einsatzbereiten JSONL-Format für die Abstimmung.

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

Im folgenden Beispiel wird der gleiche Inhalt im vorherigen text-bison-Beispiel gezeigt, jedoch im Gemini-Format. Dieses Beispiel ist erweitert, damit Sie das Format verstehen.

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

Das folgende Beispiel enthält den gleichen Inhalt wie im vorherigen Beispiel, jedoch in einem einsatzbereiten JSONL-Format für die Abstimmung.

{"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 in Gemini konvertieren

Das folgende Beispiel zeigt, wie ein chat-bison-Dataset in ein Gemini-Dataset konvertiert wird. Dieses Beispiel ist erweitert, damit Sie das Format verstehen.

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

Das folgende Beispiel enthält den gleichen Inhalt wie im vorherigen Beispiel, jedoch in einem einsatzbereiten JSONL-Format für die Abstimmung.

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

Im folgenden Beispiel wird der gleiche Inhalt im vorherigen chat-bison-Beispiel gezeigt, aber im Gemini-Format. Dieses Beispiel ist erweitert, damit Sie das Format verstehen.

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

Das folgende Beispiel enthält den gleichen Inhalt wie im vorherigen Beispiel, jedoch in einem einsatzbereiten JSONL-Format für die Abstimmung.

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

Nächste Schritte