Giới thiệu
Bắt đầu hands-on với Google Cloud! Bài này setup môi trường hoàn chỉnh để fine-tune Gemini models.
1. Google Cloud Setup
# 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. Vertex AI SDK
pip install google-cloud-aiplatform
from google.cloud import aiplatform
aiplatform.init(
project="my-finetuning-project",
location="us-central1",
)
3. GCS Bucket cho Training Data
gsutil mb gs://my-finetuning-data/
gsutil cp training_data.jsonl gs://my-finetuning-data/
4. Pricing Deep-dive
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! 🎉
Tóm tắt
- Google Cloud setup: project → APIs → SDK → GCS bucket
- Vertex AI là fully managed — không cần quản lý GPU
- Chi phí training cực thấp ($0.30–$50 cho hầu hết use cases)
- Free trial $300 credit đủ cho toàn bộ khóa học
Bài tập
- Setup Google Cloud project và enable Vertex AI
- Install SDK và test connection
- Upload sample dataset lên GCS
- Tính chi phí ước tính cho dataset của bạn