Erogare modelli aperti Gemma utilizzando GPU su GKE con vLLM

Per pubblicare Gemma 4 Gemma 4 su Google Kubernetes Engine (GKE) con il framework vLLM utilizzando le GPU, devi eseguire il provisioning di un cluster GKE con acceleratori supportati, come le GPU NVIDIA H100.

Per pubblicare i modelli Gemma 4, il container vLLM predefinito è configurato per caricare le ponderazioni del modello. Le ponderazioni verranno caricate dai bucket Cloud Storage (specificati dall'argomento --model).

Una volta caricate le ponderazioni, il container vLLM espone un endpoint API compatibile con OpenAI per l'inferenza con throughput elevato.

Questo tutorial è destinato a ingegneri di machine learning (ML), amministratori e operatori di piattaforme e specialisti di dati e AI interessati a utilizzare le funzionalità di orchestrazione dei container Kubernetes per pubblicare carichi di lavoro AI/ML sull'hardware GPU H100.

Prima di leggere questa pagina, assicurati di conoscere i seguenti argomenti:

Obiettivi

Questo tutorial fornisce le basi per comprendere ed esplorare il deployment pratico di LLM per l'inferenza in un ambiente Kubernetes gestito.

  1. Prepara l'ambiente con un cluster GKE in modalità Autopilot.
  2. Esegui il deployment di un container vLLM nel cluster.
  3. Utilizza vLLM per erogare il modello Gemma 4 tramite l'interfaccia curl.

Prima di iniziare

  • 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

  • Assicurati di avere il seguente ruolo o i seguenti ruoli nel progetto: roles/container.admin, roles/iam.serviceAccountAdmin

    Controlla i ruoli

    1. Nella Cloud de Confiance console vai alla pagina IAM.

      Vai a IAM
    2. Seleziona il progetto.
    3. Nella colonna Entità, trova tutte le righe che identificano te o un gruppo di cui fai parte. Per scoprire i gruppi di cui fai parte, contatta l' amministratore.

    4. Per tutte le righe che ti specificano o ti includono, controlla la colonna Ruolo per verificare se l'elenco dei ruoli include i ruoli richiesti.

    Concedi i ruoli

    1. Nella Cloud de Confiance console vai alla pagina IAM.

      Vai a IAM
    2. Seleziona il progetto.
    3. Fai clic su Concedi l'accesso.
    4. Nel campo Nuove entità, inserisci il tuo identificatore dell'utente. In genere si tratta dell'identificatore di un utente in un pool di identità della forza lavoro. Per maggiori dettagli, consulta Rappresenta gli utenti del pool di forza lavoro nelle policy IAM o contatta l'amministratore.

    5. Fai clic su Seleziona un ruolo, quindi cerca il ruolo.
    6. Per concedere altri ruoli, fai clic su Aggiungi un altro ruolo e aggiungi ogni ruolo aggiuntivo.
    7. Fai clic su Salva.

Prepara l'ambiente

In questo tutorial utilizzerai kubectl e gcloud CLI per gestire le risorse ospitate su Cloud de Confiance by S3NS. Puoi autorizzare l'accesso con gcloud CLI Cloud de Confiance by S3NS.

Per configurare l'ambiente con gcloud CLI, segui questi passaggi:

  1. Imposta le variabili di ambiente predefinite in 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
    

    Sostituisci i seguenti valori:

    • PROJECT_ID: il tuo Cloud de Confiance ID progetto.
    • REGION: la regione u-france-east1 che supporta le GPU H100. Puoi scoprire quali GPU sono disponibili in ogni regione.
    • CLUSTER_NAME: il nome del tuo cluster.
    • GSA_NAME: il nome del service account Google, ad esempio gemma-gsa.
    • KSA_NAME: il nome del service account Kubernetes, ad esempio gemma-ksa.
    • NAMESPACE: lo spazio dei nomi Kubernetes, ad esempio default.
    • MODEL_BUCKET_NAME: il nome del bucket Cloud Storage in cui verranno archiviate le ponderazioni del modello. Può avere lo stesso nome del modello selezionato, ad esempio gemma-4-26b-it.

Crea e configura Cloud de Confiance le risorse

Segui queste istruzioni per creare le risorse richieste.

Crea un cluster GKE e un pool di nodi

Puoi pubblicare Gemma su GPU in un cluster GKE Autopilot. Il cluster Autopilot offre un'esperienza Kubernetes completamente gestita.

Autopilot

In gcloud CLI, esegui il comando seguente:

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

Sostituisci i seguenti valori:

  • PROJECT_ID: il tuo Cloud de Confiance ID progetto.
  • CLUSTER_NAME: il nome del tuo cluster.
  • REGION: la regione in cui si trova il cluster.

GKE crea un cluster Autopilot con nodi CPU e GPU come richiesto dai carichi di lavoro di cui è stato eseguito il deployment.

Crea un bucket Cloud Storage

  1. In gcloud CLI, esegui il comando seguente:

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

    Viene creato un bucket Cloud Storage per archiviare i file del modello scaricati da Hugging Face.

  2. Scarica e carica le ponderazioni del modello:

    Devi ottenere le ponderazioni del modello Gemma per le versioni che intendi erogare (ad es. da Hugging Face o altre fonti ufficiali). Organizza i file scaricati localmente in directory. Ad esempio:

    • ./gemma-4-26b-it-local/ (contenente tutti i file per il modello 26B IT)
    • ./gemma-4-31b-it-local/ (contenente tutti i file per il modello 31B IT)

    Carica queste directory nel bucket Cloud Storage con i prefissi specifici previsti dai manifest di 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}
    

    Questa struttura di comando garantisce che i file del modello si trovino in percorsi come gs://${MODEL_BUCKET_NAME}/config.json e così via.

Configura Workload Identity per l'accesso a Cloud Storage

Per consentire ai pod Kubernetes di accedere in modo sicuro al bucket Cloud Storage contenente le ponderazioni del modello, devi configurare Workload Identity di GKE.

  1. Crea il service account Google (GSA):

    gcloud iam service-accounts create ${GSA_NAME} \
      --project=${PROJECT_ID}
    
  2. Determina ed esporta l'indirizzo email del GSA:

    Il formato dell'indirizzo email dipende dal fatto che ${PROJECT_ID} sia con ambito di dominio (contiene i due punti).

    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. Crea il service account Kubernetes (KSA):

    Questo KSA viene utilizzato nel manifest di deployment.

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

    Verifica la creazione

    kubectl get serviceaccounts --namespace ${NAMESPACE}
    
  4. Aggiungi un'annotazione al KSA per collegarlo al GSA:

    Questa annotazione indica a GKE quale GSA può rappresentare il KSA.

    kubectl annotate serviceaccount ${KSA_NAME} \
      --namespace ${NAMESPACE} \
      iam.gke.io/gcp-service-account=${GSA_EMAIL}
    
  5. Concedi al KSA l'autorizzazione a rappresentare il GSA:

    Questo binding IAM sul GSA consente al KSA di agire come 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. Concedi al GSA l'autorizzazione a leggere dal bucket:

    Concedi al GSA il ruolo storage.objectViewer nel bucket.

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

Esegui il deployment dei modelli Gemma 4 su vLLM

Per eseguire il deployment dei modelli Gemma 4, crea bucket Cloud Storage per ogni modello per archiviare le ponderazioni del modello e applica un manifest di deployment Kubernetes per le dimensioni del modello selezionato. Un deployment è un oggetto API Kubernetes che consente di eseguire più repliche di pod distribuiti tra i nodi di un cluster.

Procedura

L'applicazione di questo manifest esegue il pull dell'immagine container vLLM, richiede una GPU NVIDIA e si connette automaticamente alle ponderazioni del modello dai bucket Cloud Storage per avviare il motore di inferenza vLLM.

Gemma 4 26B-A4B-it

Segui queste istruzioni per eseguire il deployment del modello Gemma 4 26B-A4B ottimizzato per le istruzioni.

  1. Crea il seguente manifest vllm-4-26b-a4b-it.yaml:

    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. Applica il manifest:

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

    Se vuoi, puoi limitare le dimensioni della finestra contestuale a 16 K utilizzando l'opzione vLLM --max-model-len=16384. Se vuoi una finestra contestuale più grande (fino a 128 K), modifica il manifest e la configurazione del node pool con una maggiore capacità GPU.

Gemma 4 31B-it

Segui queste istruzioni per eseguire il deployment del modello Gemma 4 31B ottimizzato per le istruzioni.

  1. Crea il seguente manifest vllm-4-31b-it.yaml:

    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. Applica il manifest:

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

    Nel nostro esempio, limitiamo le dimensioni della finestra contestuale a 16 K utilizzando l'opzione vLLM --max-model-len=16384. Se vuoi una finestra contestuale più grande (fino a 128 K), modifica il manifest e la configurazione del node pool con una maggiore capacità GPU.

Verifica

  1. Attendi che il deployment sia disponibile:

    kubectl wait --for=condition=Available --timeout=1800s deployment/vllm-gemma-deployment
    
  2. Visualizza i log del deployment in esecuzione:

    kubectl logs -f -l app=gemma-server
    

    La risorsa Deployment scarica i dati del modello Gemma. Questo processo può richiedere alcuni minuti. L'output è simile al seguente:

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

Una volta disponibile il deployment, configura il port forwarding per interagire con il modello.

Eroga il modello

In questa sezione interagisci con il modello. Prima di procedere, assicurati che il modello sia stato scaricato completamente.

Configura port forwarding

Esegui il comando seguente per configurare il port forwarding al modello:

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

L'output è simile al seguente:

Forwarding from 127.0.0.1:8080 -> 8080

Interagisci con il modello utilizzando curl

Questa sezione mostra come eseguire un test di base per verificare i modelli Gemma 4 ottimizzati per le istruzioni di cui è stato eseguito il deployment. Per altri modelli, sostituisci gemma-4-26B-A4B-it con il nome del modello corrispondente.

Questo esempio mostra come testare il modello Gemma 4 26B ottimizzato per le istruzioni con input di solo testo.

In una nuova sessione del terminale, utilizza curl per chattare con il modello:

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
}'

L'output è simile al seguente:

{
  "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
}

Risoluzione dei problemi

  • Se visualizzi il messaggio Empty reply from server, è possibile che il container non abbia terminato il download dei dati del modello. Controlla di nuovo i log del pod per il messaggio Connected, che indica che il modello è pronto per l'erogazione.
  • Se visualizzi Connection refused, verifica che il tuo port forwarding sia attivo.

Osserva le prestazioni del modello

Per visualizzare le dashboard per le metriche di osservabilità di un modello, segui questi passaggi:

  1. Nella Cloud de Confiance console vai alla pagina Modelli di cui è stato eseguito il deployment.

    Vai a Modelli di cui è stato eseguito il deployment

  2. Per visualizzare i dettagli del deployment specifico, inclusi metriche, log e dashboard, fai clic sul nome del modello nell'elenco.

  3. Nella pagina dei dettagli del modello, fai clic sulla scheda Osservabilità per visualizzare le seguenti dashboard. Se richiesto, fai clic su Abilita per abilitare la raccolta delle metriche per il cluster.

    • La dashboard Utilizzo dell'infrastruttura mostra le metriche di utilizzo.
    • La dashboard DCGM mostra le metriche DCGM.
    • Se utilizzi vLLM, è disponibile la dashboard Prestazioni del modello che mostra le metriche per le prestazioni del modello vLLM.

Puoi anche visualizzare le metriche nell'integrazione della dashboard vLLM in Cloud Monitoring. Queste metriche vengono aggregate per tutti i deployment vLLM senza filtri preimpostati

vLLM espone le metriche in formato Prometheus per impostazione predefinita; non è necessario installare un esportatore aggiuntivo. Per informazioni sull'utilizzo di Google Cloud Managed Service per Prometheus per raccogliere le metriche dal modello, consulta le vLLM di vLLM nella documentazione di Cloud Monitoring.

Libera spazio

Per evitare che al tuo account Google Cloud vengano addebitati costi relativi alle risorse utilizzate in questo tutorial, elimina il progetto che contiene le risorse oppure mantieni il progetto ed elimina le singole risorse.

Elimina le risorse di cui è stato eseguito il deployment

Per evitare che al tuo Cloud de Confiance account vengano addebitati costi relativi alle risorse create in questa guida, esegui il comando seguente:

gcloud container clusters delete CLUSTER_NAME \
    --location=REGION

Sostituisci i seguenti valori:

  • REGION: la regione del cluster.
  • CLUSTER_NAME: il nome del tuo cluster.

Passaggi successivi