การรองรับการปรับแต่งโดยละเอียดของ Gemini API มอบกลไกในการดูแลจัดการเอาต์พุตเมื่อคุณมีชุดข้อมูลขนาดเล็กของตัวอย่างอินพุต/เอาต์พุต โปรดดูรายละเอียดเพิ่มเติมในคำแนะนำการปรับแต่งโมเดลและบทแนะนำ
เมธอด: tuneModels.create
สร้างโมเดลที่ปรับแต่ง ตรวจสอบความคืบหน้าในการปรับแต่งขั้นกลาง (หากมี) ผ่านบริการ google.longrunning.Operations
เข้าถึงสถานะและผลลัพธ์ผ่านบริการการดำเนินการ ตัวอย่าง: GET /v1/tunedModels/az2mb0bpw6i/operations/000-111-222
ปลายทาง
โพสต์
https://generativelanguage.googleapis.com/v1beta/tunedModels
พารามิเตอร์การค้นหา
tunedModelId
string
ไม่บังคับ รหัสที่ไม่ซ้ำกันสำหรับโมเดลที่ปรับแต่ง (หากระบุไว้) ค่านี้ต้องยาวไม่เกิน 40 อักขระ โดยอักขระตัวแรกต้องเป็นตัวอักษร และสุดท้ายอาจเป็นตัวอักษรหรือตัวเลข รหัสต้องตรงกับนิพจน์ทั่วไป: [a-z]([a-z0-9-]{0,38}[a-z0-9])?
เนื้อหาของคำขอ
เนื้อความของคำขอมีอินสแตนซ์ของ TunedModel
displayName
string
ไม่บังคับ ชื่อที่จะแสดงสำหรับโมเดลนี้ในอินเทอร์เฟซผู้ใช้ ชื่อที่แสดงต้องมีความยาวไม่เกิน 40 อักขระ รวมเว้นวรรค
description
string
ไม่บังคับ คำอธิบายสั้นๆ ของโมเดลนี้
tuningTask
object (TuningTask
)
ต้องระบุ งานการปรับแต่งที่จะสร้างโมเดลที่ปรับแต่ง
source_model
โมเดลที่ใช้เป็นจุดเริ่มต้นของการปรับแต่ง source_model
ต้องเป็นค่าใดค่าหนึ่งต่อไปนี้
tunedModelSource
object (TunedModelSource
)
ไม่บังคับ TunedModel ใช้เป็นจุดเริ่มต้นสำหรับการฝึกโมเดลใหม่
baseModel
string
เปลี่ยนแปลงไม่ได้ ชื่อของ Model
ที่จะปรับแต่ง ตัวอย่าง: models/gemini-1.5-flash-001
temperature
number
ไม่บังคับ ควบคุมการสุ่มของเอาต์พุต
ค่าในช่วงได้เกินกว่า [0.0,1.0]
ค่าที่ใกล้กับ 1.0
จะทำให้ได้คำตอบที่หลากหลายมากขึ้น ส่วนค่าที่ใกล้กับ 0.0
มักจะทำให้ได้คำตอบจากโมเดลที่ไม่น่าประหลาดใจน้อยลง
ค่านี้ระบุค่าเริ่มต้นให้เป็นค่าที่โมเดลฐานใช้ขณะสร้างโมเดล
topP
number
ไม่บังคับ สำหรับการสุ่มตัวอย่างนิวเคลียส
การสุ่มตัวอย่างนิวเคลียสจะพิจารณาชุดโทเค็นที่เล็กที่สุดที่มีผลรวมความน่าจะเป็นอย่างน้อย topP
ค่านี้ระบุค่าเริ่มต้นให้เป็นค่าที่โมเดลฐานใช้ขณะสร้างโมเดล
topK
integer
ไม่บังคับ สำหรับการสุ่มตัวอย่างแบบ Top-k
การสุ่มตัวอย่างแบบ Top-k จะพิจารณาชุดโทเค็นที่เป็นไปได้มากที่สุด topK
รายการ ค่านี้จะระบุค่าเริ่มต้นที่จะใช้โดยแบ็กเอนด์ขณะทำการเรียกใช้โมเดล
ค่านี้ระบุค่าเริ่มต้นให้เป็นค่าที่โมเดลฐานใช้ขณะสร้างโมเดล
ตัวอย่างคำขอ
Python
เนื้อหาการตอบกลับ
ทรัพยากรนี้แสดงการดำเนินการที่ใช้เวลานานซึ่งเป็นผลมาจากการเรียก API เครือข่าย
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีข้อมูลซึ่งมีโครงสร้างดังต่อไปนี้
name
string
ชื่อที่เซิร์ฟเวอร์กำหนด ซึ่งจะไม่ซ้ำกันเฉพาะในบริการเดียวกันที่ส่งคืนมาตั้งแต่แรกเท่านั้น หากคุณใช้การแมป HTTP เริ่มต้น name
ควรเป็นชื่อทรัพยากรที่ลงท้ายด้วย operations/{unique_id}
metadata
object
ข้อมูลเมตาเฉพาะบริการที่เชื่อมโยงกับการดำเนินการ ซึ่งมักมีข้อมูลความคืบหน้าและข้อมูลเมตาทั่วไป เช่น เวลาที่สร้าง โดยบางบริการอาจไม่มีข้อมูลเมตาดังกล่าว เมธอดใดก็ตามที่ส่งกลับการดำเนินการที่ใช้เวลานานควรระบุประเภทข้อมูลเมตา หากมี
ออบเจ็กต์ที่มีช่องประเภทที่กำหนดเอง ช่องเพิ่มเติม "@type"
จะมี URI ที่ระบุประเภท ตัวอย่างเช่น { "id": 1234, "@type": "types.example.com/standard/id" }
done
boolean
หากค่าเป็น false
แสดงว่าการดำเนินการยังดำเนินอยู่ หากเป็น true
การดำเนินการนี้จะเสร็จสมบูรณ์ และสามารถใช้ error
หรือ response
ได้
result
ผลการดำเนินการ ซึ่งอาจเป็น error
หรือ response
ที่ถูกต้องก็ได้ หาก done
== false
จะไม่มีการตั้งค่าทั้ง error
และ response
หาก done
== true
จะสามารถตั้งค่า error
หรือ response
ได้ 1 รายการ บริการบางอย่างอาจแสดงผลลัพธ์ไม่ได้ result
ต้องเป็นค่าใดค่าหนึ่งต่อไปนี้
error
object (Status
)
ผลลัพธ์ข้อผิดพลาดของการดำเนินการในกรณีที่ดำเนินการไม่สำเร็จหรือถูกยกเลิก
response
object
การตอบสนองที่สำเร็จของการดำเนินการ หากวิธีเดิมไม่แสดงข้อมูลเกี่ยวกับความสำเร็จ เช่น Delete
ระบบจะตอบกลับเป็น google.protobuf.Empty
หากเมธอดต้นฉบับคือ Get
/Create
/Update
มาตรฐาน การตอบกลับควรเป็นแหล่งข้อมูล สำหรับวิธีการอื่นๆ การตอบกลับควรเป็นประเภท XxxResponse
โดยที่ Xxx
เป็นชื่อเมธอดเดิม เช่น หากชื่อเมธอดเดิมคือ TakeSnapshot()
ประเภทการตอบกลับที่อนุมานจะเป็น TakeSnapshotResponse
ออบเจ็กต์ที่มีช่องประเภทที่กำหนดเอง ช่องเพิ่มเติม "@type"
จะมี URI ที่ระบุประเภท ตัวอย่างเช่น { "id": 1234, "@type": "types.example.com/standard/id" }
การแสดง JSON |
---|
{ "name": string, "metadata": { "@type": string, field1: ..., ... }, "done": boolean, // Union field |
เมธอด: TunModels.generateContent
สร้างการตอบสนองของโมเดลที่มีอินพุต GenerateContentRequest
โปรดดูคำแนะนำสำหรับการสร้างข้อความสำหรับข้อมูลการใช้งานโดยละเอียด ความสามารถในการป้อนข้อมูลจะแตกต่างกันไปในแต่ละโมเดล รวมถึงโมเดลที่ปรับแต่งด้วย ดูรายละเอียดได้ในคู่มือรุ่นและคู่มือการปรับแต่ง
ปลายทาง
โพสต์
https://generativelanguage.googleapis.com/v1beta/{model=tunedModels/*}:generateContent
พารามิเตอร์เส้นทาง
model
string
ต้องระบุ ชื่อของ Model
ที่จะใช้ในการสร้างการดำเนินการให้เสร็จสมบูรณ์
รูปแบบ: name=models/{model}
โดยใช้รูปแบบ tunedModels/{tunedmodel}
เนื้อหาของคำขอ
เนื้อหาของคำขอมีข้อมูลที่มีโครงสร้างต่อไปนี้
contents[]
object (Content
)
ต้องระบุ เนื้อหาของการสนทนาปัจจุบันกับโมเดล
สำหรับการค้นหาแบบเลี้ยวเดียว อินสแตนซ์นี้เป็นอินสแตนซ์เดียว สำหรับคำค้นหาแบบหลายผู้ใช้ เช่น แชท ช่องนี้จะเป็นช่องที่ซ้ำซึ่งมีประวัติการสนทนาและคำขอล่าสุด
tools[]
object (Tool
)
ไม่บังคับ รายการของ Tools
ที่ Model
อาจใช้เพื่อสร้างคำตอบถัดไป
Tool
คือโค้ดที่ช่วยให้ระบบโต้ตอบกับระบบภายนอกเพื่อดำเนินการหรือชุดการทำงานนอกเหนือจากความรู้และขอบเขตของ Model
ได้ Tool
ที่รองรับคือ Function
และ codeExecution
โปรดดูข้อมูลเพิ่มเติมที่การเรียกใช้ฟังก์ชันและคำแนะนำการเรียกใช้โค้ด
toolConfig
object (ToolConfig
)
ไม่บังคับ การกำหนดค่าเครื่องมือสำหรับ Tool
ที่ระบุไว้ในคำขอ ดูตัวอย่างการใช้งานได้ที่คู่มือการเรียกใช้ฟังก์ชัน
safetySettings[]
object (SafetySetting
)
ไม่บังคับ รายการอินสแตนซ์ SafetySetting
ที่ไม่ซ้ำกันสำหรับการบล็อกเนื้อหาที่ไม่ปลอดภัย
สิ่งนี้จะบังคับใช้ในGenerateContentRequest.contents
และGenerateContentResponse.candidates
ประเภท SafetyCategory
แต่ละประเภทไม่ควรมีการตั้งค่ามากกว่า 1 รายการ API จะบล็อกเนื้อหาและการตอบกลับทั้งหมดที่ไม่ตรงตามเกณฑ์ที่การตั้งค่าเหล่านี้กำหนดไว้ รายการนี้จะลบล้างการตั้งค่าเริ่มต้นสำหรับแต่ละ SafetyCategory
ที่ระบุใน safetySettings หากไม่มี SafetySetting
สำหรับ SafetyCategory
ที่ระบุในรายการ API จะใช้การตั้งค่าความปลอดภัยเริ่มต้นสำหรับหมวดหมู่นั้น สนับสนุนหมวดหมู่อันตราย HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT ดูข้อมูลโดยละเอียดเกี่ยวกับการตั้งค่าความปลอดภัยที่ใช้ได้ในคำแนะนำ นอกจากนี้ โปรดดูคำแนะนำด้านความปลอดภัยเพื่อดูวิธีนำข้อควรพิจารณาด้านความปลอดภัยไปใช้กับแอปพลิเคชัน AI ของคุณ
systemInstruction
object (Content
)
ไม่บังคับ นักพัฒนาแอปตั้งค่าคำสั่งของระบบ ขณะนี้มีเพียงข้อความเท่านั้น
generationConfig
object (GenerationConfig
)
ไม่บังคับ ตัวเลือกการกำหนดค่าสำหรับการสร้างและเอาต์พุตโมเดล
cachedContent
string
ไม่บังคับ ชื่อของเนื้อหาที่แคชเพื่อใช้เป็นบริบทในการแสดงการคาดคะเน รูปแบบ: cachedContents/{cachedContent}
ตัวอย่างคำขอ
ข้อความ
Python
Node.js
Go
เปลือกหอย
Kotlin
Swift
Dart
Java
รูปภาพ
Python
Node.js
Go
เปลือกหอย
Kotlin
Swift
Dart
Java
เสียง
Python
Node.js
เปลือกหอย
วิดีโอ
Python
Node.js
Go
เปลือกหอย
Python
เปลือกหอย
แชท
Python
Node.js
Go
เปลือกหอย
Kotlin
Swift
Dart
Java
แคช
Python
Node.js
โมเดลที่ปรับแล้ว
Python
โหมด JSON
Python
Node.js
Go
เปลือกหอย
Kotlin
Swift
Dart
Java
การเรียกใช้โค้ด
Python
Kotlin
Java
การเรียกใช้ฟังก์ชัน
Python
Node.js
เปลือกหอย
Kotlin
Swift
Dart
Java
การกำหนดค่าการสร้าง
Python
Node.js
Go
เปลือกหอย
Kotlin
Swift
Dart
Java
การตั้งค่าความปลอดภัย
Python
Node.js
Go
เปลือกหอย
Kotlin
Swift
Dart
Java
คำแนะนำของระบบ
Python
Node.js
Go
เปลือกหอย
Kotlin
Swift
Dart
Java
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ GenerateContentResponse
เมธอด: tuneModels.get
รับข้อมูลเกี่ยวกับ TunedModel ที่เฉพาะเจาะจง
ปลายทาง
ซื้อ
https://generativelanguage.googleapis.com/v1beta/{name=tunedModels/*}
พารามิเตอร์เส้นทาง
name
string
ต้องระบุ ชื่อทรัพยากรของโมเดล
รูปแบบ: tunedModels/my-model-id
อยู่ในรูปแบบ tunedModels/{tunedmodel}
เนื้อหาของคำขอ
เนื้อหาของคำขอต้องว่างเปล่า
ตัวอย่างคำขอ
Python
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ TunedModel
เมธอด: tuneModels.list
รายการโมเดลที่ปรับแต่งแล้ว
ปลายทาง
ซื้อ
https://generativelanguage.googleapis.com/v1beta/tunedModels
พารามิเตอร์การค้นหา
pageSize
integer
ไม่บังคับ จำนวนสูงสุด TunedModels
ที่จะแสดงผล (ต่อหน้า) บริการอาจแสดงโมเดลที่มีการปรับแต่งน้อยกว่า
หากไม่ระบุ ระบบจะแสดงผลโมเดลที่ปรับแต่งไม่เกิน 10 รายการ เมธอดนี้จะแสดงโมเดลสูงสุด 1, 000 รายการต่อหน้า แม้ว่าคุณจะส่ง pageSize ที่ใหญ่กว่าก็ตาม
pageToken
string
ไม่บังคับ โทเค็นของหน้าเว็บที่ได้รับจากการโทร tunedModels.list
ก่อนหน้า
ระบุ pageToken
ที่ส่งคืนโดยคำขอ 1 รายการเป็นอาร์กิวเมนต์ของคำขอถัดไปเพื่อเรียกหน้าถัดไป
เมื่อใส่เลขหน้า พารามิเตอร์อื่นๆ ทั้งหมดที่ให้กับ tunedModels.list
ต้องตรงกับการเรียกใช้ที่ระบุโทเค็นของหน้าเว็บ
filter
string
ไม่บังคับ ตัวกรองคือการค้นหาข้อความแบบเต็มในคำอธิบายและชื่อที่แสดงของโมเดลที่ปรับแต่ง โดยค่าเริ่มต้น ผลการค้นหาจะไม่รวมโมเดลที่ปรับแต่งซึ่งแชร์กับทุกคน
โอเปอเรเตอร์เพิ่มเติม: - owner:me - writers:me -คุณลักษณะผู้อ่าน:me - ผู้อ่าน:ทุกคน
ตัวอย่าง: "owner:me" จะแสดงโมเดลที่ปรับแต่งทั้งหมดซึ่งผู้โทรมีบทบาทเจ้าของ "readers:me" จะแสดงโมเดลที่ปรับแต่งทั้งหมดซึ่งผู้โทรมีบทบาทผู้อ่าน "ผู้ใช้:ทุกคน" จะแสดงโมเดลที่ปรับแต่งทั้งหมดที่แชร์กับทุกคน
เนื้อหาของคำขอ
เนื้อหาของคำขอต้องว่างเปล่า
ตัวอย่างคำขอ
Python
เนื้อหาการตอบกลับ
การตอบกลับจาก tunedModels.list
ที่มีรายการโมเดลที่ใส่เลขหน้า
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีข้อมูลซึ่งมีโครงสร้างดังต่อไปนี้
tunedModels[]
object (TunedModel
)
โมเดลที่แสดงผล
nextPageToken
string
โทเค็นซึ่งสามารถส่งเป็น pageToken
เพื่อเรียกข้อมูลหน้าถัดไป
หากเว้นช่องนี้ไว้ จะไม่มีหน้าเพิ่มเติม
การแสดง JSON |
---|
{
"tunedModels": [
{
object ( |
เมธอด: tuneModels.patch
อัปเดตโมเดลที่ปรับแต่ง
ปลายทาง
แพตช์
https://generativelanguage.googleapis.com/v1beta/{tunedModel.name=tunedModels/*}
PATCH https://generativelanguage.googleapis.com/v1beta/{tunedModel.name=tunedModels/*}
พารามิเตอร์เส้นทาง
tunedModel.name
string
เอาต์พุตเท่านั้น ชื่อโมเดลที่ปรับแต่ง ระบบจะสร้างชื่อที่ไม่ซ้ำกันขึ้นเมื่อสร้าง ตัวอย่าง: tunedModels/az2mb0bpw6i
หากตั้งค่า displayName เมื่อสร้าง ส่วนรหัสของชื่อจะมีการตั้งค่าโดยการเชื่อมโยงคำของ displayName เข้ากับขีดกลาง และเพิ่มส่วนแบบสุ่มเพื่อความไม่ซ้ำกัน
ตัวอย่าง
- displayName =
Sentence Translator
- name =
tunedModels/sentence-translator-u3b7m
ซึ่งจะอยู่ในรูปแบบtunedModels/{tunedmodel}
พารามิเตอร์การค้นหา
updateMask
string (FieldMask
format)
ต้องระบุ รายการช่องที่จะอัปเดต
ซึ่งเป็นรายการชื่อที่ตรงตามเกณฑ์ทั้งหมดของช่องที่คั่นด้วยคอมมา ตัวอย่าง: "user.displayName,photo"
เนื้อหาของคำขอ
เนื้อความของคำขอมีอินสแตนซ์ของ TunedModel
displayName
string
ไม่บังคับ ชื่อที่จะแสดงสำหรับโมเดลนี้ในอินเทอร์เฟซผู้ใช้ ชื่อที่แสดงต้องมีความยาวไม่เกิน 40 อักขระ รวมเว้นวรรค
description
string
ไม่บังคับ คำอธิบายสั้นๆ ของโมเดลนี้
tuningTask
object (TuningTask
)
ต้องระบุ งานการปรับแต่งที่จะสร้างโมเดลที่ปรับแต่ง
source_model
โมเดลที่ใช้เป็นจุดเริ่มต้นของการปรับแต่ง source_model
ต้องเป็นค่าใดค่าหนึ่งต่อไปนี้
tunedModelSource
object (TunedModelSource
)
ไม่บังคับ TunedModel ใช้เป็นจุดเริ่มต้นสำหรับการฝึกโมเดลใหม่
temperature
number
ไม่บังคับ ควบคุมการสุ่มของเอาต์พุต
ค่าในช่วงได้เกินกว่า [0.0,1.0]
ค่าที่ใกล้กับ 1.0
จะทำให้ได้คำตอบที่หลากหลายมากขึ้น ส่วนค่าที่ใกล้กับ 0.0
มักจะทำให้ได้คำตอบจากโมเดลที่ไม่น่าประหลาดใจน้อยลง
ค่านี้ระบุค่าเริ่มต้นให้เป็นค่าที่โมเดลฐานใช้ขณะสร้างโมเดล
topP
number
ไม่บังคับ สำหรับการสุ่มตัวอย่างนิวเคลียส
การสุ่มตัวอย่างนิวเคลียสจะพิจารณาชุดโทเค็นที่เล็กที่สุดที่มีผลรวมความน่าจะเป็นอย่างน้อย topP
ค่านี้ระบุค่าเริ่มต้นให้เป็นค่าที่โมเดลฐานใช้ขณะสร้างโมเดล
topK
integer
ไม่บังคับ สำหรับการสุ่มตัวอย่างแบบ Top-k
การสุ่มตัวอย่างแบบ Top-k จะพิจารณาชุดโทเค็นที่เป็นไปได้มากที่สุด topK
รายการ ค่านี้จะระบุค่าเริ่มต้นที่จะใช้โดยแบ็กเอนด์ขณะทำการเรียกใช้โมเดล
ค่านี้ระบุค่าเริ่มต้นให้เป็นค่าที่โมเดลฐานใช้ขณะสร้างโมเดล
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ TunedModel
เมธอด: tuneModels.delete
ลบโมเดลที่ปรับแต่ง
ปลายทาง
ลบ
https://generativelanguage.googleapis.com/v1beta/{name=tunedModels/*}
พารามิเตอร์เส้นทาง
name
string
ต้องระบุ ชื่อทรัพยากรของโมเดล รูปแบบ: tunedModels/my-model-id
อยู่ในรูปแบบ tunedModels/{tunedmodel}
เนื้อหาของคำขอ
เนื้อหาของคำขอต้องว่างเปล่า
เนื้อหาการตอบกลับ
หากสำเร็จ เนื้อหาการตอบกลับจะว่างเปล่า
ทรัพยากร REST: tuneModels
- แหล่งข้อมูล: TunedModel
- TunedModelSource
- สถานะ
- TuningTask
- TuningSnapshot
- ชุดข้อมูล
- TuningExamples
- TuningExample
- ไฮเปอร์พารามิเตอร์
- เมธอด
แหล่งข้อมูล: TunedModel
โมเดลที่ปรับแต่งแล้วซึ่งสร้างโดยใช้ ModelService.CreateTunedModel
name
string
เอาต์พุตเท่านั้น ชื่อโมเดลที่ปรับแต่ง ระบบจะสร้างชื่อที่ไม่ซ้ำกันขึ้นเมื่อสร้าง ตัวอย่าง: tunedModels/az2mb0bpw6i
หากตั้งค่า displayName เมื่อสร้าง ส่วนรหัสของชื่อจะมีการตั้งค่าโดยการเชื่อมโยงคำของ displayName เข้ากับขีดกลาง และเพิ่มส่วนแบบสุ่มเพื่อความไม่ซ้ำกัน
ตัวอย่าง
- displayName =
Sentence Translator
- ชื่อ =
tunedModels/sentence-translator-u3b7m
displayName
string
ไม่บังคับ ชื่อที่จะแสดงสำหรับโมเดลนี้ในอินเทอร์เฟซผู้ใช้ ชื่อที่แสดงต้องมีความยาวไม่เกิน 40 อักขระ รวมเว้นวรรค
description
string
ไม่บังคับ คำอธิบายสั้นๆ ของโมเดลนี้
state
enum (State
)
เอาต์พุตเท่านั้น สถานะของโมเดลที่ปรับแต่ง
createTime
string (Timestamp
format)
เอาต์พุตเท่านั้น การประทับเวลาเมื่อสร้างรูปแบบนี้
การประทับเวลาเป็น RFC3339 UTC "Zulu" โดยมีความละเอียดระดับนาโนวินาทีและมีเลขเศษส่วนสูงสุด 9 หลัก ตัวอย่าง: "2014-10-02T15:01:23Z"
และ "2014-10-02T15:01:23.045123456Z"
updateTime
string (Timestamp
format)
เอาต์พุตเท่านั้น การประทับเวลาเมื่ออัปเดตโมเดลนี้
การประทับเวลาเป็น RFC3339 UTC "Zulu" โดยมีความละเอียดระดับนาโนวินาทีและมีเลขเศษส่วนสูงสุด 9 หลัก ตัวอย่าง: "2014-10-02T15:01:23Z"
และ "2014-10-02T15:01:23.045123456Z"
tuningTask
object (TuningTask
)
ต้องระบุ งานการปรับแต่งที่จะสร้างโมเดลที่ปรับแต่ง
source_model
โมเดลที่ใช้เป็นจุดเริ่มต้นของการปรับแต่ง source_model
ต้องเป็นค่าใดค่าหนึ่งต่อไปนี้
tunedModelSource
object (TunedModelSource
)
ไม่บังคับ TunedModel ใช้เป็นจุดเริ่มต้นสำหรับการฝึกโมเดลใหม่
baseModel
string
เปลี่ยนแปลงไม่ได้ ชื่อของ Model
ที่จะปรับแต่ง ตัวอย่าง: models/gemini-1.5-flash-001
temperature
number
ไม่บังคับ ควบคุมการสุ่มของเอาต์พุต
ค่าในช่วงได้เกินกว่า [0.0,1.0]
ค่าที่ใกล้กับ 1.0
จะทำให้ได้คำตอบที่หลากหลายมากขึ้น ส่วนค่าที่ใกล้กับ 0.0
มักจะทำให้ได้คำตอบจากโมเดลที่ไม่น่าประหลาดใจน้อยลง
ค่านี้ระบุค่าเริ่มต้นให้เป็นค่าที่โมเดลฐานใช้ขณะสร้างโมเดล
topP
number
ไม่บังคับ สำหรับการสุ่มตัวอย่างนิวเคลียส
การสุ่มตัวอย่างนิวเคลียสจะพิจารณาชุดโทเค็นที่เล็กที่สุดที่มีผลรวมความน่าจะเป็นอย่างน้อย topP
ค่านี้ระบุค่าเริ่มต้นให้เป็นค่าที่โมเดลฐานใช้ขณะสร้างโมเดล
topK
integer
ไม่บังคับ สำหรับการสุ่มตัวอย่างแบบ Top-k
การสุ่มตัวอย่างแบบ Top-k จะพิจารณาชุดโทเค็นที่เป็นไปได้มากที่สุด topK
รายการ ค่านี้จะระบุค่าเริ่มต้นที่จะใช้โดยแบ็กเอนด์ขณะทำการเรียกใช้โมเดล
ค่านี้ระบุค่าเริ่มต้นให้เป็นค่าที่โมเดลฐานใช้ขณะสร้างโมเดล
การแสดง JSON |
---|
{ "name": string, "displayName": string, "description": string, "state": enum ( |
TunedModelSource
ปรับโมเดลเป็นแหล่งที่มาสำหรับการฝึกโมเดลใหม่
tunedModel
string
เปลี่ยนแปลงไม่ได้ ชื่อของ TunedModel
ที่จะใช้เป็นจุดเริ่มต้นสำหรับการฝึกโมเดลใหม่ ตัวอย่าง: tunedModels/my-tuned-model
baseModel
string
เอาต์พุตเท่านั้น ชื่อของฐาน Model
ของ TunedModel
นี้มาจากการปรับแต่ง ตัวอย่าง: models/gemini-1.5-flash-001
การแสดง JSON |
---|
{ "tunedModel": string, "baseModel": string } |
รัฐ
สถานะของโมเดลที่ปรับแต่ง
Enum | |
---|---|
STATE_UNSPECIFIED |
ค่าเริ่มต้น ค่านี้ไม่ได้ใช้ |
CREATING |
กำลังสร้างโมเดล |
ACTIVE |
โมเดลนี้พร้อมใช้งานแล้ว |
FAILED |
สร้างโมเดลไม่สำเร็จ |
TuningTask
งานการปรับแต่งที่สร้างโมเดลที่ปรับแต่ง
startTime
string (Timestamp
format)
เอาต์พุตเท่านั้น การประทับเวลาเมื่อเริ่มต้นการปรับแต่งโมเดลนี้
การประทับเวลาเป็น RFC3339 UTC "Zulu" โดยมีความละเอียดระดับนาโนวินาทีและมีเลขเศษส่วนสูงสุด 9 หลัก ตัวอย่าง: "2014-10-02T15:01:23Z"
และ "2014-10-02T15:01:23.045123456Z"
completeTime
string (Timestamp
format)
เอาต์พุตเท่านั้น การประทับเวลาเมื่อปรับแต่งโมเดลนี้เสร็จสมบูรณ์
การประทับเวลาเป็น RFC3339 UTC "Zulu" โดยมีความละเอียดระดับนาโนวินาทีและมีเลขเศษส่วนสูงสุด 9 หลัก ตัวอย่าง: "2014-10-02T15:01:23Z"
และ "2014-10-02T15:01:23.045123456Z"
snapshots[]
object (TuningSnapshot
)
เอาต์พุตเท่านั้น เมตริกที่รวบรวมระหว่างการปรับแต่ง
trainingData
object (Dataset
)
ต้องระบุ อินพุตเท่านั้น เปลี่ยนแปลงไม่ได้ ข้อมูลการฝึกโมเดล
hyperparameters
object (Hyperparameters
)
เปลี่ยนแปลงไม่ได้ ไฮเปอร์พารามิเตอร์ที่ควบคุมกระบวนการปรับแต่ง หากไม่ระบุ ระบบจะใช้ค่าเริ่มต้น
การแสดง JSON |
---|
{ "startTime": string, "completeTime": string, "snapshots": [ { object ( |
TuningSnapshot
บันทึกสำหรับขั้นตอนการปรับแต่งเพียงขั้นตอนเดียว
step
integer
เอาต์พุตเท่านั้น ขั้นตอนการปรับแต่ง
epoch
integer
เอาต์พุตเท่านั้น Epoch เป็นส่วนประกอบของขั้นตอนนี้
meanLoss
number
เอาต์พุตเท่านั้น การสูญเสียเฉลี่ยของตัวอย่างการฝึกสำหรับขั้นตอนนี้
computeTime
string (Timestamp
format)
เอาต์พุตเท่านั้น การประทับเวลาที่มีการคำนวณเมตริกนี้
การประทับเวลาเป็น RFC3339 UTC "Zulu" โดยมีความละเอียดระดับนาโนวินาทีและมีเลขเศษส่วนสูงสุด 9 หลัก ตัวอย่าง: "2014-10-02T15:01:23Z"
และ "2014-10-02T15:01:23.045123456Z"
การแสดง JSON |
---|
{ "step": integer, "epoch": integer, "meanLoss": number, "computeTime": string } |
ชุดข้อมูล
ชุดข้อมูลสำหรับการฝึกหรือการตรวจสอบ
dataset
ข้อมูลในบรรทัดหรือการอ้างอิงข้อมูล dataset
ต้องเป็นค่าใดค่าหนึ่งต่อไปนี้
examples
object (TuningExamples
)
ไม่บังคับ ตัวอย่างในหน้า
การแสดง JSON |
---|
{ // Union field |
TuningExamples
ตัวอย่างการปรับแต่ง อาจเป็นข้อมูลการฝึกหรือการตรวจสอบ
examples[]
object (TuningExample
)
ต้องระบุ ตัวอย่าง ตัวอย่างอินพุตอาจเป็นข้อความหรือการสนทนาก็ได้ แต่ตัวอย่างทั้งหมดในชุดต้องเป็นประเภทเดียวกัน
การแสดง JSON |
---|
{
"examples": [
{
object ( |
TuningExample
ตัวอย่างเดียวสำหรับการปรับแต่ง
output
string
ต้องระบุ เอาต์พุตโมเดลที่คาดไว้
model_input
อินพุตของโมเดลสำหรับตัวอย่างนี้ model_input
ต้องเป็นค่าใดค่าหนึ่งต่อไปนี้
textInput
string
ไม่บังคับ อินพุตรูปแบบข้อความ
การแสดง JSON |
---|
{ "output": string, // Union field |
ไฮเปอร์พารามิเตอร์
ไฮเปอร์พารามิเตอร์ที่ควบคุมกระบวนการปรับแต่ง อ่านเพิ่มเติมที่ https://ai.google.dev/docs/model_tuning_guidance
learning_rate_option
ตัวเลือกสำหรับการระบุอัตราการเรียนรู้ระหว่างการปรับแต่ง learning_rate_option
ต้องเป็นค่าใดค่าหนึ่งต่อไปนี้
learningRate
number
ไม่บังคับ เปลี่ยนแปลงไม่ได้ ไฮเปอร์พารามิเตอร์ของอัตราการเรียนรู้สำหรับการปรับแต่ง หากไม่ได้ตั้งค่า ระบบจะคำนวณค่าเริ่มต้น 0.001 หรือ 0.0002 ตามจำนวนตัวอย่างการฝึก
learningRateMultiplier
number
ไม่บังคับ เปลี่ยนแปลงไม่ได้ ตัวคูณอัตราการเรียนรู้ใช้ในการคำนวณอัตราการเรียนรู้สุดท้ายโดยอิงตามค่าเริ่มต้น (แนะนำ) อัตราการเรียนรู้จริง := learningRateMultiplier * อัตราการเรียนรู้เริ่มต้น อัตราการเรียนรู้เริ่มต้นจะขึ้นอยู่กับโมเดลฐานและขนาดชุดข้อมูล หากไม่ได้ตั้งค่า ระบบจะใช้ค่าเริ่มต้น 1.0
epochCount
integer
เปลี่ยนแปลงไม่ได้ จำนวน Epoch การฝึก Epoch คือการส่งผ่านข้อมูลการฝึก 1 ครั้ง หากไม่ได้ตั้งค่า ระบบจะใช้ค่าเริ่มต้นที่ 5
batchSize
integer
เปลี่ยนแปลงไม่ได้ ไฮเปอร์พารามิเตอร์ของขนาดกลุ่มสำหรับการปรับแต่ง หากไม่ได้ตั้งค่า ระบบจะใช้ค่าเริ่มต้น 4 หรือ 16 ตามจำนวนตัวอย่างการฝึก
การแสดง JSON |
---|
{ // Union field |