生成式 AI 微調與呼叫 (Google AI Studio)
登入 Google AI Studio
取得 API keys
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Create new prompt
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
建立資料集
- 設定多個 input 及 output
- 使用一問一答(Q&A)、多輪對話、任務導向型對話…等方式
- 可嘗試將相關檔案上傳到AI Studio透過語言模型協助產生資料集
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
選擇模型及輸出設定
- 中文自述如何換算tokens
- 模型比較表
模型 |
用途 |
即用即付(美元價格) |
免費 |
gemini-1.0-pro |
自然語言工作、多輪文字和程式碼聊天,以及產生程式碼 |
$1.50 / 1 million tokens |
15 RPM(每分鐘請求數)/ 32,000 TPM(每分鐘令牌)/ 1,500 RPD(每天請求) |
gemini-1.5-pro |
複雜的推理工作,例如程式碼和文字生成、文字編輯、問題解決、資料擷取及產生 |
$21.00 / 1 million tokens |
2 RPM(每分鐘請求數) / 32,000 TPM(每分鐘令牌)/ 50 RPD(每天請求) |
gemini-1.5-flash |
快速靈活地處理各種工作 |
$2.10 / 1 million tokens |
15 RPM(每分鐘請求數) / 100 萬個 TPM(每分鐘令牌) / 1,500 RPD(每天請求) |

Tune a model
-
選擇基底模型

-
調整微調參數
- Tuning epochsinfo
- Learning rate multiplierinfo
- Batch sizeinfo

查看訓練結果

測試模型問答
- 輸入資料集中所包含的 input ,並確認 output 是否為理想答案
- 如果 output 文不對題,則重新調整參數訓練

使用 OAuth 進行身份驗證
- 透過身分驗證才能讀取到已訓練的模型
- 請準備以下
- 在 Google Cloud 控制台中,啟用 Google 產生語言 API。
- 在 Google Cloud 控制台中,前往選單> API 和服務> OAuth 同意畫面。
- 授權桌面應用程式的憑證
透過 函數 或 flask 呼叫模型
- 工作資料夾
token.json
(運行 load_creds.py 後自動生成)
client_secret.json
(上一個步驟產生)
load_creds.py
(將client_secret.json轉換為token.json)
show.py
(顯示可用模型)
main.py
(主程式)
test.py
(需要運行 main.py
)
- 環境安裝
pip install Flask
pip install google-generativeai
load_creds.py