2.7 KiB
2.7 KiB
🚀 VERTEX AI SETUP - COMPLETE GUIDE
OPTION 1: Application Default Credentials (Easiest)
Step 1: Install Google Cloud CLI
# Check if installed
gcloud --version
# If not, install:
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
Step 2: Login & Set Project
# Login to Google Cloud
gcloud auth application-default login
# Set your project
gcloud config set project gen-lang-client-0428644398
# Verify
gcloud config get-value project
Step 3: Enable Vertex AI API
# Enable the API
gcloud services enable aiplatform.googleapis.com
# Verify it's enabled
gcloud services list --enabled | grep aiplatform
Step 4: Test the Script
# Run test
python3 scripts/test_vertex_ai_simple.py
If successful: You'll see a test_vertex_output.png file generated! ✅
OPTION 2: Service Account (If Option 1 fails)
Step 1: Create Service Account
# Create service account
gcloud iam service-accounts create vertex-ai-image-gen \
--description="For Vertex AI Imagen image generation" \
--display-name="Vertex AI Image Generator"
Step 2: Grant Permissions
# Grant Vertex AI User role
gcloud projects add-iam-policy-binding gen-lang-client-0428644398 \
--member="serviceAccount:vertex-ai-image-gen@gen-lang-client-0428644398.iam.gserviceaccount.com" \
--role="roles/aiplatform.user"
Step 3: Download JSON Key
# Create and download key
gcloud iam service-accounts keys create ~/vertex-ai-key.json \
--iam-account=vertex-ai-image-gen@gen-lang-client-0428644398.iam.gserviceaccount.com
# Verify
ls -la ~/vertex-ai-key.json
Step 4: Set Environment Variable
# Add to ~/.zshrc
echo 'export GOOGLE_APPLICATION_CREDENTIALS="$HOME/vertex-ai-key.json"' >> ~/.zshrc
# Reload
source ~/.zshrc
# Verify
echo $GOOGLE_APPLICATION_CREDENTIALS
Step 5: Test
python3 scripts/test_vertex_ai_simple.py
TROUBLESHOOTING:
Error: "Permission denied"
# Grant additional permissions
gcloud projects add-iam-policy-binding gen-lang-client-0428644398 \
--member="serviceAccount:vertex-ai-image-gen@gen-lang-client-0428644398.iam.gserviceaccount.com" \
--role="roles/aiplatform.admin"
Error: "API not enabled"
gcloud services enable aiplatform.googleapis.com
Error: "Quota exceeded"
Check: https://console.cloud.google.com/apis/api/aiplatform.googleapis.com/quotas
NEXT STEPS AFTER SUCCESS:
- ✅ Test script works
- 🔄 Integrate into
generate_all_biomes_complete.py - 🚀 Run bulk generation (3000+ images!)
- 🎉 Complete all biomes!
START HERE: Try Option 1 first (Application Default Credentials) - it's simpler!