簡介
親身體驗 Google Cloud!本文建立了一個完整的環境來微調 Gemini 模型。
1. 谷歌雲端設置
# Install Google Cloud CLI
curl https://sdk.cloud.google.com | bash
gcloud init
# Create project
gcloud projects create my-finetuning-project
gcloud config set project my-finetuning-project
# Enable APIs
gcloud services enable aiplatform.googleapis.com
gcloud services enable storage.googleapis.com
2.頂點AI SDK
pip install google-cloud-aiplatform
from google.cloud import aiplatform
aiplatform.init(
project="my-finetuning-project",
location="us-central1",
)
3. 用於訓練資料的 GCS 桶
gsutil mb gs://my-finetuning-data/
gsutil cp training_data.jsonl gs://my-finetuning-data/
4. 定價深入探討
Gemini 2.0 Flash Fine-tuning:
├── Training: ~$0.40 per 1M tokens
├── Inference: Same as base model ($0.075/1M input, $0.30/1M output)
├── Storage: GCS standard pricing
└── Evaluation: Billed as batch prediction
Ví dụ tính:
├── Dataset: 500 examples × 500 tokens = 250K tokens
├── Epochs: 3 → 750K training tokens
├── Training cost: 750K × $0.40/1M = $0.30
└── TỔNG: ~$0.30 cho 1 lần fine-tune! 🎉
總結
- Google Cloud 設定:專案 → API → SDK → GCS 儲存桶
- Vertex AI 完全託管 — 無需 GPU 管理
- 極低的訓練成本(大多數用例為 0.30 美元至 50 美元)
- 免費試用 300 美元學分足以完成整個課程
練習
- 設定 Google Cloud 專案並啟用 Vertex AI 2.安裝SDK並測試連接
- 將樣本資料集上傳至GCS
- 計算資料集的估計成本