Menyajikan model terbuka Gemma menggunakan GPU di GKE dengan vLLM

Untuk menyajikan model bahasa besar (LLM) Gemma 4 di Google Kubernetes Engine (GKE) dengan framework vLLM menggunakan GPU, Anda harus menyediakan cluster GKE dengan akselerator yang didukung, seperti GPU NVIDIA H100.

Untuk menyajikan model Gemma 4, container vLLM bawaan dikonfigurasi untuk memuat bobot model. Bobot akan dimuat dari bucket Cloud Storage (ditentukan oleh argumen --model).

Setelah bobot dimuat, penampung vLLM akan mengekspos endpoint API yang kompatibel dengan OpenAI untuk inferensi throughput tinggi.

Tutorial ini ditujukan untuk engineer Machine Learning (ML), admin dan operator Platform, serta spesialis Data dan AI yang tertarik untuk menggunakan kemampuan orkestrasi container Kubernetes untuk melayani workload AI/ML di hardware GPU H100.

Sebelum membaca halaman ini, pastikan Anda memahami hal-hal berikut:

Tujuan

Tutorial ini memberikan dasar untuk memahami dan menjelajahi deployment LLM praktis untuk inferensi di lingkungan Kubernetes terkelola.

  1. Siapkan lingkungan Anda dengan cluster GKE dalam mode Autopilot.
  2. Deploy container vLLM ke cluster Anda.
  3. Gunakan vLLM untuk menyajikan model Gemma 4 melalui antarmuka curl.

Sebelum memulai

  • In the Cloud de Confiance console, on the project selector page, select or create a Cloud de Confiance project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  • Verify that billing is enabled for your Cloud de Confiance project.

  • Enable the required API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  • Pastikan Anda memiliki peran berikut di project: roles/container.admin, roles/iam.serviceAccountAdmin

    Memeriksa peran

    1. Di konsol Cloud de Confiance , buka halaman IAM.

      Buka IAM
    2. Pilih project.
    3. Di kolom Akun utama, temukan semua baris yang mengidentifikasi Anda atau grup yang Anda ikuti. Untuk mengetahui grup mana saja yang Anda ikuti, hubungi administrator Anda.

    4. Untuk semua baris yang menentukan atau menyertakan Anda, periksa kolom Peran untuk melihat apakah daftar peran menyertakan peran yang diperlukan.

    Memberikan peran

    1. Di konsol Cloud de Confiance , buka halaman IAM.

      Buka IAM
    2. Pilih project.
    3. Klik Grant access.
    4. Di kolom New principals, masukkan ID pengguna Anda. Biasanya, ini adalah ID untuk pengguna dalam workforce identity pool. Untuk mengetahui detailnya, baca bagian Merepresentasikan pengguna workforce pool dalam kebijakan IAM, atau hubungi administrator Anda.

    5. Klik Pilih peran, lalu telusuri peran.
    6. Untuk memberikan peran tambahan, klik Add another role, lalu tambahkan tiap peran tambahan.
    7. Klik Simpan.
  • Pastikan project Anda memiliki kuota yang cukup untuk GPU H100. Untuk mengetahui informasi selengkapnya, lihat Tentang GPU dan Kuota alokasi.

Menyiapkan lingkungan Anda

Dalam tutorial ini, Anda akan menggunakan kubectl dan gcloud CLI untuk mengelola resource yang dihosting di Cloud de Confiance by S3NS. Anda dapat melakukan otorisasi dengan gcloud CLI untuk mengakses Cloud de Confiance by S3NS.

Untuk menyiapkan lingkungan Anda dengan gcloud CLI, ikuti langkah-langkah berikut:

  1. Tetapkan variabel lingkungan default di gcloud CLI:

    gcloud config set project PROJECT_ID
    gcloud config set billing/quota_project PROJECT_ID
    export PROJECT_ID=$(gcloud config get project)
    export REGION=u-france-east1
    export CLUSTER_NAME=CLUSTER_NAME
    export GSA_NAME=GSA_NAME
    export KSA_NAME=KSA_NAME
    export NAMESPACE=NAMESPACE
    export PROJECT_NUMBER=$(gcloud projects describe PROJECT_ID --format="value(projectNumber)")
    export MODEL_BUCKET_NAME=MODEL_BUCKET_NAME
    

    Ganti nilai berikut:

    • PROJECT_ID: Project ID Cloud de Confiance Anda.
    • REGION: u-france-east1 region yang mendukung GPU H100. Anda dapat menemukan GPU mana yang tersedia di region mana.
    • CLUSTER_NAME: nama cluster Anda.
    • GSA_NAME: nama untuk Akun Layanan Google, misalnya, gemma-gsa.
    • KSA_NAME: nama untuk ServiceAccount Kubernetes, misalnya, gemma-ksa.
    • NAMESPACE: namespace Kubernetes, misalnya, default.
    • MODEL_BUCKET_NAME: nama bucket Cloud Storage tempat bobot model akan disimpan. Nama ini bisa sama dengan nama model yang dipilih, seperti gemma-4-26b-it.

Membuat dan mengonfigurasi resource Cloud de Confiance

Ikuti petunjuk berikut untuk membuat resource yang diperlukan.

Membuat cluster dan node pool GKE

Anda dapat menyajikan Gemma di GPU dalam cluster GKE Autopilot. Cluster Autopilot memberikan pengalaman Kubernetes yang terkelola sepenuhnya.

Autopilot

Di gcloud CLI, jalankan perintah berikut:

gcloud container clusters create-auto CLUSTER_NAME \
    --project=PROJECT_ID \
    --location=REGION \
    --release-channel=rapid

Ganti nilai berikut:

  • PROJECT_ID: Project ID Cloud de Confiance Anda.
  • CLUSTER_NAME: nama cluster Anda.
  • REGION: region tempat cluster Anda berada.

GKE membuat cluster Autopilot dengan node CPU dan GPU seperti yang diminta oleh workload yang di-deploy.

Membuat bucket Cloud Storage

  1. Di gcloud CLI, jalankan perintah berikut:

    gcloud storage buckets create gs://${MODEL_BUCKET_NAME} \
      --project=${PROJECT_ID} \
      --location=${REGION} \
      --uniform-bucket-level-access
    

    Tindakan ini akan membuat bucket Cloud Storage untuk menyimpan file model yang Anda download dari Hugging Face.

  2. Mendownload dan Mengupload Bobot Model:

    Anda harus mendapatkan bobot model Gemma untuk versi yang ingin Anda sajikan (misalnya, dari Hugging Face atau sumber resmi lainnya). Atur file yang didownload secara lokal ke dalam direktori. Contoh:

    • ./gemma-4-26b-it-local/ (berisi semua file untuk model IT 26B)
    • ./gemma-4-31b-it-local/ (berisi semua file untuk model IT 31B)

    Upload direktori ini ke bucket Cloud Storage Anda dengan awalan tertentu yang diharapkan oleh manifes deployment:

    # Upload files for the 26B IT model
    gcloud storage cp --recursive ./gemma-4-26b-it-local/* gs://${MODEL_BUCKET_NAME}
    
    # Upload files for the 31B IT model
    gcloud storage cp --recursive ./gemma-4-31b-it-local/* gs://${MODEL_BUCKET_NAME}
    

    Struktur perintah ini memastikan file model berada di jalur seperti gs://${MODEL_BUCKET_NAME}/config.json, dll.

Mengonfigurasi Workload Identity untuk Akses Cloud Storage

Untuk mengizinkan pod Kubernetes Anda mengakses bucket Cloud Storage yang berisi bobot model dengan aman, Anda akan mengonfigurasi GKE Workload Identity.

  1. Buat Akun Layanan Google (GSA):

    gcloud iam service-accounts create ${GSA_NAME} \
      --project=${PROJECT_ID}
    
  2. Menentukan dan Mengekspor Email GSA:

    Format email bergantung pada apakah ${PROJECT_ID} Anda tercakup dalam domain (berisi titik dua).

    if [[ $PROJECT_ID == *:* ]]; then
      DOMAIN=$(echo $PROJECT_ID | cut -d: -f1)
      PROJ_NAME=$(echo $PROJECT_ID | cut -d: -f2)
      export GSA_EMAIL="${GSA_NAME}@${PROJ_NAME}.${DOMAIN}.s3ns.iam.gserviceaccount.com"
    else
      export GSA_EMAIL="${GSA_NAME}@${PROJECT_ID}.s3ns.iam.gserviceaccount.com"
    fi
      echo "Using GSA Email: ${GSA_EMAIL}"
    
  3. Buat Akun Layanan Kubernetes (KSA):

    KSA ini digunakan dalam manifes deployment Anda.

    kubectl create serviceaccount ${KSA_NAME} --namespace ${NAMESPACE}
    

    Memverifikasi pembuatan

    kubectl get serviceaccounts --namespace ${NAMESPACE}
    
  4. Anotasi KSA untuk Menautkannya ke GSA:

    Anotasi ini memberi tahu GKE GSA mana yang dapat di-impersonate oleh KSA.

    kubectl annotate serviceaccount ${KSA_NAME} \
      --namespace ${NAMESPACE} \
      iam.gke.io/gcp-service-account=${GSA_EMAIL}
    
  5. Memberi Izin KSA untuk Meniru Identitas GSA:

    Binding IAM ini di GSA memungkinkan KSA bertindak sebagai GSA.

    if [[ $PROJECT_ID == *:* ]]; then
      DOMAIN=$(echo $PROJECT_ID | cut -d: -f1)
      PROJ_NAME=$(echo $PROJECT_ID | cut -d: -f2)
      export WI_MEMBER="serviceAccount:${PROJ_NAME}.${DOMAIN}.s3ns.svc.id.goog[${NAMESPACE}/${KSA_NAME}]"
    else
      export WI_MEMBER="serviceAccount:${PROJECT_ID}.s3ns.svc.id.goog[${NAMESPACE}/${KSA_NAME}]"
    fi
    
    gcloud iam service-accounts add-iam-policy-binding ${GSA_EMAIL} \
      --role roles/iam.workloadIdentityUser \
      --member="${WI_MEMBER}" \
      --project=${PROJECT_ID}
    
  6. Beri Izin GSA untuk Membaca dari Bucket:

    Berikan peran storage.objectViewer kepada GSA di bucket.

    gcloud storage buckets add-iam-policy-binding gs://${MODEL_BUCKET_NAME} \
      --member="serviceAccount:${GSA_EMAIL}" \
      --role="roles/storage.objectViewer" \
      --project=${PROJECT_ID}
    

Men-deploy model Gemma 4 di vLLM

Untuk men-deploy model Gemma 4, buat bucket Cloud Storage untuk setiap model guna menyimpan bobot model, dan terapkan manifes Deployment Kubernetes untuk ukuran model yang Anda pilih. Deployment adalah objek Kubernetes API yang memungkinkan Anda menjalankan beberapa replika Pod yang didistribusikan di antara node dalam cluster.

Prosedur

Penerapan manifes ini akan menarik image container vLLM, meminta GPU NVIDIA, dan otomatis terhubung ke bobot model dari bucket Cloud Storage untuk memulai mesin inferensi vLLM.

Gemma 4 26B-A4B-it

Ikuti petunjuk ini untuk men-deploy model yang di-tune untuk perintah Gemma 4 26B-A4B.

  1. Buat manifes vllm-4-26b-a4b-it.yaml berikut:

    apiVersion: cloud.google.com/v1
    kind: ComputeClass
    metadata:
      name: a3-edgegpu-8g-nolssd
    spec:
      priorities:
      - machineType: a3-edgegpu-8g-nolssd
        gpu:
          count: 8
          type: nvidia-h100-80gb
      nodePoolAutoCreation:
        enabled: true
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: vllm-gemma-deployment
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: gemma-server
      template:
        metadata:
          labels:
            app: gemma-server
            ai.gke.io/model: gemma-4-26b-a4b-it
            ai.gke.io/inference-server: vllm
            examples.ai.gke.io/source: user-guide
        spec:
          containers:
          - name: inference-server
            image: us-docker.pkg.dev/vertex-ai/vertex-vision-model-garden-dockers/pytorch-vllm-serve:gemma4
            resources:
              requests:
                cpu: "20"
                memory: "80Gi"
                ephemeral-storage: "80Gi"
                nvidia.com/gpu: "1"
              limits:
                cpu: "20"
                memory: "80Gi"
                ephemeral-storage: "80Gi"
                nvidia.com/gpu: "1"
            command: ["./entrypoint.sh"] # Use the image's entrypoint
            args:
            - "python"
            - "-m"
            - "vllm.entrypoints.api_server"
            - "--host=0.0.0.0"
            - "--port=8080"
            - "--model=gs://gemma-4-26b-it" # YOUR Cloud Storage PATH
            - "--tensor-parallel-size=1"
            - "--max-num-seqs=128"
            - "--gpu-memory-utilization=0.9"
            - "--limit_mm_per_prompt.image=1"
            - "--enable-auto-tool-choice"
            - "--tool-call-parser=gemma4"
            - "--reasoning-parser=gemma4"
            ports:
            - containerPort: 8080
            env:
            - name: GOOGLE_CLOUD_UNIVERSE_DOMAIN
              value: "s3nsapis.fr"
            - name: CLOUDSDK_CORE_UNIVERSE_DOMAIN
              value: "s3nsapis.fr"
            - name: GCS_URI_ARG_KEY
              value: "model"
            - name: GCS_URI_ENV_KEY
              value: "AIP_STORAGE_URI"
            - name: LORA_ADAPTER_ARG_KEY
              value: "lora-modules"
            - name: HF_HUB_ENABLE_HF_TRANSFER
              value: "1"
            volumeMounts:
            - mountPath: /dev/shm
              name: dshm
          volumes:
          - name: dshm
            emptyDir:
              medium: Memory
          nodeSelector:
            cloud.google.com/compute-class: a3-edgegpu-8g-nolssd
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: llm-service
    spec:
      selector:
        app: gemma-server
      type: ClusterIP
      ports:
        - protocol: TCP
          port: 8080
          targetPort: 8080
    
    
  2. Terapkan manifes:

    kubectl apply -f vllm-4-26b-a4b-it.yaml
    

    Jika mau, Anda dapat membatasi ukuran jendela konteks hingga 16 K menggunakan opsi vLLM --max-model-len=16384. Jika Anda menginginkan ukuran jendela konteks yang lebih besar (hingga 128 K), sesuaikan konfigurasi manifes dan node pool Anda dengan kapasitas GPU yang lebih besar.

Gemma 4 31B-it

Ikuti petunjuk berikut untuk men-deploy model yang di-tune dengan perintah Gemma 4 31B.

  1. Buat manifes vllm-4-31b-it.yaml berikut:

    apiVersion: cloud.google.com/v1
    kind: ComputeClass
    metadata:
      name: a3-edgegpu-8g-nolssd
    spec:
      priorities:
      - machineType: a3-edgegpu-8g-nolssd
        gpu:
          count: 8
          type: nvidia-h100-80gb
      nodePoolAutoCreation:
        enabled: true
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: vllm-gemma-deployment
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: gemma-server
      template:
        metadata:
          labels:
            app: gemma-server
            ai.gke.io/model: gemma-4-31b-it
            ai.gke.io/inference-server: vllm
            examples.ai.gke.io/source: user-guide
        spec:
          containers:
          - name: inference-server
            image: us-docker.pkg.dev/vertex-ai/vertex-vision-model-garden-dockers/pytorch-vllm-serve:gemma4
            resources:
              requests:
                cpu: "20"
                memory: "80Gi"
                ephemeral-storage: "80Gi"
                nvidia.com/gpu: "1"
              limits:
                cpu: "20"
                memory: "80Gi"
                ephemeral-storage: "80Gi"
                nvidia.com/gpu: "1"
            command: ["./entrypoint.sh"] # Use the image's entrypoint
            args:
            - "python"
            - "-m"
            - "vllm.entrypoints.api_server"
            - "--host=0.0.0.0"
            - "--port=8080"
            - "--model=gs://gemma-4-31b-it" # YOUR Cloud Storage PATH
            - "--tensor-parallel-size=1"
            - "--max-num-seqs=128"
            - "--gpu-memory-utilization=0.9"
            - "--limit_mm_per_prompt.image=1"
            - "--enable-auto-tool-choice"
            - "--tool-call-parser=gemma4"
            - "--reasoning-parser=gemma4"
            ports:
            - containerPort: 8080
            env:
            - name: GOOGLE_CLOUD_UNIVERSE_DOMAIN
              value: "s3nsapis.fr"
            - name: CLOUDSDK_CORE_UNIVERSE_DOMAIN
              value: "s3nsapis.fr"
            - name: GCS_URI_ARG_KEY
              value: "model"
            - name: GCS_URI_ENV_KEY
              value: "AIP_STORAGE_URI"
            - name: LORA_ADAPTER_ARG_KEY
              value: "lora-modules"
            - name: HF_HUB_ENABLE_HF_TRANSFER
              value: "1"
            volumeMounts:
            - mountPath: /dev/shm
              name: dshm
          volumes:
          - name: dshm
            emptyDir:
              medium: Memory
          nodeSelector:
            cloud.google.com/compute-class: a3-edgegpu-8g-nolssd
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: llm-service
    spec:
      selector:
        app: gemma-server
      type: ClusterIP
      ports:
        - protocol: TCP
          port: 8080
          targetPort: 8080
    
    
  2. Terapkan manifes:

    kubectl apply -f vllm-4-31b-it.yaml
    

    Dalam contoh ini, kita membatasi ukuran jendela konteks sebesar 16 K menggunakan opsi vLLM --max-model-len=16384. Jika Anda menginginkan ukuran jendela konteks yang lebih besar (hingga 128 K), sesuaikan manifes dan konfigurasi node pool dengan kapasitas GPU yang lebih besar.

Verifikasi

  1. Tunggu hingga Deployment tersedia:

    kubectl wait --for=condition=Available --timeout=1800s deployment/vllm-gemma-deployment
    
  2. Lihat log dari Deployment yang sedang berjalan:

    kubectl logs -f -l app=gemma-server
    

    Resource Deployment mendownload data model Gemma. Proses ini dapat memerlukan waktu beberapa menit. Outputnya mirip dengan hal berikut ini:

      ...
      ...
      (APIServer pid=1) INFO:     Started server process [1]
      (APIServer pid=1) INFO:     Waiting for application startup.
      (APIServer pid=1) INFO:     Application startup complete.
    

Setelah deployment tersedia, siapkan penerusan port untuk berinteraksi dengan model.

Menyajikan model

Di bagian ini, Anda akan berinteraksi dengan model. Pastikan model didownload sepenuhnya sebelum melanjutkan.

Menyiapkan penerusan port

Jalankan perintah berikut untuk menyiapkan penerusan port ke model:

kubectl port-forward svc/llm-service 8080:8080 --namespace default &

Outputnya mirip dengan hal berikut ini:

Forwarding from 127.0.0.1:8080 -> 8080

Berinteraksi dengan model menggunakan curl

Bagian ini menunjukkan cara melakukan pengujian cepat dasar untuk memverifikasi model yang di-tune dengan perintah Gemma 4 yang di-deploy. Untuk model lainnya, ganti gemma-4-26B-A4B-it dengan nama model masing-masing.

Contoh ini menunjukkan cara menguji model yang di-tune untuk mengikuti perintah Gemma 4 26B dengan input hanya teks.

Dalam sesi terminal baru, gunakan curl untuk memulai percakapan dengan model Anda:

curl http://127.0.0.1:8080/v1/chat/completions \
-X POST \
-H "Content-Type: application/json" \
-d '{
    "model": "google/gemma-4-26B-A4B-it",
    "messages": [
        {
          "role": "user",
          "content": "Why is the sky blue?"
        }
    ],
    "chat_template_kwargs": {
         "enable_thinking": true
    },
    "skip_special_tokens": false
}'

Outputnya akan terlihat mirip seperti berikut:

{
  "id": "chatcmpl-be75ccfcbdf753d1",
  "object": "chat.completion",
  "created": 1775006187,
  "model": "google/gemma-4-26B-A4B-it",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The short answer is a phenomenon called **Rayleigh scattering**.\n\nTo understand how it works, you have to look at three things: sunlight, the Earth's atmosphere, and how light travels.\n\n### 1. Sunlight is a Rainbow\nAlthough sunlight looks white to us, it is actually made up of all the colors of the rainbow (red, orange, yellow, green, blue, indigo, and violet). Light travels as **waves**, and each color has a different wavelength:\n*   **Red light** travels in long, lazy, wide waves.\n*   **Blue and violet light** travel in short, choppy, tight waves.\n\n### 2. The Atmosphere is an Obstacle Course\nEarth's atmosphere is filled with gases (mostly nitrogen and oxygen). As sunlight travels through the atmosphere, it strikes the molecules of these gases. \n\nBecause the gas molecules are very small, they affect the colors differently based on their wavelength:\n*   The **long waves** (reds and yellows) pass through the atmosphere mostly straight, without hitting much. They are like large ocean waves that roll right over small pebbles.\n*   The **short waves** (blues and violets) strike the gas molecules and get scattered in every direction. They are like small ripples that hit a pebble and splash everywhere.\n\nBecause this blue light is being scattered in every direction by the air, when you look up, your eyes are catching that scattered blue light coming from every part of the sky.\n\n### 3. Why isn't the sky violet?\nIf violet light has an even shorter wavelength than blue light, you might wonder why the sky doesn't look purple. There are two main reasons:\n1.  **The Sun's output:** The Sun emits much more blue light than violet light.\n2.  **Human Biology:** Human eyes are much more sensitive to blue than to violet. Our eyes interpret the scatter of mixed blue and violet light simply as pale blue.\n\n---\n\n### Bonus: Why are sunsets red?\nWhen the sun is setting, it is much lower on the horizon. This means the sunlight has to travel through a much **thicker** layer of the atmosphere to reach your eyes. \n\nBy the time the light gets to you, the blue light has been scattered away completely로. Only the long-wavelength colors—the reds, oranges, and pinks—are able to make it through that thick layer of air without being scattered away, creating the beautiful colors of a sunset.",
        "refusal": null,
        "annotations": null,
        "audio": null,
        "function_call": null,
        "tool_calls": [],
        "reasoning": "\"Why is the sky blue?\"\nScience/Physics (Atmospheric scattering).\nExplain the phenomenon clearly, accurately, and engagingly.\n\n    *   Sunlight (white light) is made of a spectrum of colors (ROYGBIV).\n    *   Earth's atmosphere is filled with gases (nitrogen, oxygen) and particles.\n    *   Rayleigh Scattering: Shorter wavelengths (blue/violet) scatter more easily than longer wavelengths (red/yellow) when hitting small gas molecules.\n    *   The human eye's sensitivity: Why isn't it violet?\n\n    A good scientific explanation should follow a logical flow:\n    *   *Direct Answer:* The core mechanism (Rayleigh Scattering).\n    *   *The Components:* Sunlight and the Atmosphere.\n    *   *The Mechanism:* How light interacts with gas molecules.\n    *   *The Wavelength Factor:* Comparing colors.\n    *   *The \"Wait, why not violet?\" question:* Addressing human perception.\n    *   *Bonus/Related concept:* Why sunsets are red.\n\n        *   Use the term **Rayleigh Scattering**.\n        *   Summarize: Its how sunlight interacts with the Earth's atmosphere.\n\n        *   Sunlight looks white, but it's actually a mix of all colors (the rainbow).\n        *   Each color travels as a different wavelength. Red = long/lazy waves; Blue/Violet = short/choppy waves.\n\n        *   The atmosphere is mostly Nitrogen and Oxygen.\n        *   When sunlight hits these tiny gas molecules, the light gets scattered in all directions.\n\n        *   Blue light travels in shorter, smaller waves.\n        *   Because these waves are small, they strike the gas molecules more frequently and get scattered more easily than the longer red/yellow waves.\n        *   Result: When you look up, your eyes are catching this \"scattered\" blue light coming from every direction.\n\n        *   *Technically*, violet light has an even shorter wavelength than blue, so it scatters *even more*. Why isn't the sky violet?\n        *   Two reasons: 1. The Sun emits more blue light than violet light. 2. Human eyes are much more sensitive to blue than violet.\n\n        *   Briefly mention sunsets to provide a complete picture.\n        *   At sunset, light travels through *more* atmosphere. The blue is scattered away completely, leaving only the long red/orange waves to reach your eyes.\n\n    *   *Tone Check:* Is it too academic? Use analogies (like waves in water or skipping stones) if needed, but keep it concise.\n    *   *Clarity:* Ensure the distinction between wavelength and scattering is clear."
      },
      "logprobs": null,
      "finish_reason": "stop",
      "stop_reason": 106,
      "token_ids": null
    }
  ],
  "service_tier": null,
  "system_fingerprint": null,
  "usage": {
    "prompt_tokens": 21,
    "total_tokens": 1122,
    "completion_tokens": 1101,
    "prompt_tokens_details": null
  },
  "prompt_logprobs": null,
  "prompt_token_ids": null,
  "kv_transfer_params": null
}

Memecahkan masalah

  • Jika Anda mendapatkan pesan Empty reply from server, kemungkinan penampung belum selesai mendownload data model. Periksa log Pod lagi untuk melihat pesan Connected yang menunjukkan bahwa model siap ditayangkan.
  • Jika Anda melihat Connection refused, pastikan penerusan port Anda aktif.

Mengamati performa model

Untuk melihat dasbor metrik kemampuan pengamatan model, ikuti langkah-langkah berikut:

  1. Di konsol Cloud de Confiance , buka halaman Deployed Models.

    Buka Model yang Di-deploy

  2. Untuk melihat detail tentang deployment tertentu, termasuk metrik, log, dan dasbornya, klik nama model dalam daftar.

  3. Di halaman detail model, klik tab Observability untuk melihat dasbor berikut. Jika diminta, klik Enable untuk mengaktifkan pengumpulan metrik untuk cluster.

    • Dasbor Penggunaan infrastruktur menampilkan metrik penggunaan.
    • Dasbor DCGM menampilkan metrik DCGM.
    • Jika Anda menggunakan vLLM, dasbor Performa model tersedia dan menampilkan metrik untuk performa model vLLM.

Anda juga dapat melihat metrik di integrasi dasbor vLLM di Cloud Monitoring. Metrik ini diagregasi untuk semua deployment vLLM tanpa filter preset

vLLM mengekspos metrik dalam format Prometheus secara default; Anda tidak perlu menginstal pengekspor tambahan. Untuk mengetahui informasi tentang cara menggunakan Google Cloud Managed Service for Prometheus untuk mengumpulkan metrik dari model Anda, lihat panduan kejelasan vLLM dalam dokumentasi Cloud Monitoring.

Pembersihan

Agar tidak perlu membayar biaya pada akun Google Cloud Anda untuk resource yang digunakan dalam tutorial ini, hapus project yang berisi resource tersebut, atau simpan project dan hapus setiap resource.

Menghapus resource yang di-deploy

Agar tidak menimbulkan biaya pada akun Cloud de Confiance Anda untuk resource yang Anda buat dalam panduan ini, jalankan perintah berikut:

gcloud container clusters delete CLUSTER_NAME \
    --location=REGION

Ganti nilai berikut:

  • REGION: region cluster Anda.
  • CLUSTER_NAME: nama cluster Anda.

Langkah berikutnya