Introduction
Get hands-on with Google Cloud! This article sets up a complete environment to 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 for 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! 🎉
Summary
- Google Cloud setup: project → APIs → SDK → GCS bucket
- Vertex AI is fully managed — no GPU management required
- Extremely low training costs ($0.30–$50 for most use cases)
- Free trial $300 credit enough for the entire course
Exercises
- Setup Google Cloud project and enable Vertex AI
- Install SDK and test connection
- Upload sample dataset to GCS
- Calculate the estimated cost for your dataset