הצגת מודלים פתוחים של Gemma באמצעות מעבדים גרפיים ב-GKE עם vLLM

כדי להכניס לשימוש בסביבת הייצור מודלי שפה גדולים (LLM) של Gemma 4 ב-Google Kubernetes Engine‏ (GKE) באמצעות ה-framework של vLLM עם GPUs, צריך להקצות אשכול GKE עם מאיצים נתמכים, כמו NVIDIA H100 GPUs.

כדי להכניס לשימוש בסביבת הייצור מודלים של Gemma 4, קונטיינר vLLM המובנה מראש מוגדר לטעינת משקלי המודל. המשקלים ייטענו מקטגוריות של Cloud Storage (שמצוינות על ידי הארגומנט --model).

אחרי שהמשקלים נטענים, מאגר vLLM חושף נקודת קצה של API שתואמת ל-OpenAI, להסקת מסקנות עם תפוקה גבוהה.

המדריך הזה מיועד למהנדסי למידת מכונה (ML), לאדמינים ולאופרטורים של פלטפורמות ולמומחי נתונים ו-AI שרוצים להשתמש ביכולות של Kubernetes לארגון קונטיינרים כדי להפעיל עומסי עבודה של AI/ML בחומרת GPU מסוג H100.

לפני שקוראים את הדף הזה, חשוב לוודא שמכירים את הנושאים הבאים:

מטרות

המדריך הזה מספק בסיס להבנה ולבדיקה של פריסת מודלים גדולים של שפה (LLM) למסקנות בסביבת Kubernetes מנוהלת.

  1. מכינים את הסביבה עם אשכול GKE במצב Autopilot.
  2. פורסים קונטיינר vLLM לאשכול.
  3. שימוש ב-vLLM כדי להפעיל את מודל Gemma 4 דרך ממשק curl.

לפני שמתחילים

  • 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

  • צריך לוודא שיש לכם בפרויקט את התפקיד או התפקידים הבאים: roles/container.admin, roles/iam.serviceAccountAdmin

    בדיקת התפקידים

    1. נכנסים לדף IAM במסוף Cloud de Confiance .

      כניסה לדף IAM
    2. בוחרים את הפרויקט.
    3. בעמודה Principal, מחפשים את כל השורות שמזהות אתכם או קבוצה שאתם נכללים בה. כדי לברר באילו קבוצות אתם נכללים, פנו לאדמין.

    4. בודקים את העמודה Role בכל השורות שבהן מצוין או מופיע השם שלכם, כדי לראות אם רשימת התפקידים כוללת את התפקידים הנדרשים.

    מתן התפקידים

    1. נכנסים לדף IAM במסוף Cloud de Confiance .

      כניסה לדף IAM
    2. בוחרים את הפרויקט.
    3. לוחצים על Grant access.
    4. בשדה New principals, מזינים את מזהה המשתמש. ‫ בדרך כלל זה המזהה של משתמש במאגר זהויות של כוח עבודה. למידע נוסף, קראו את המאמר ייצוג המשתמשים במאגרי כוח עבודה בכללי מדיניות IAM או פנו לאדמין שלכם.

    5. לוחצים על Select a role ומחפשים את התפקיד.
    6. כדי לתת עוד תפקידים, לוחצים על Add another role ומוסיפים אותם.
    7. לוחצים על Save.

הכנת הסביבה

במדריך הזה נשתמש ב-kubectl וב-ה-CLI של gcloud כדי לנהל משאבים שמתארחים ב-Cloud de Confiance by S3NS. אתם יכולים לבצע אימות ל-ה-CLI של gcloud כדי לגשת אל Cloud de Confiance by S3NS.

כדי להגדיר את הסביבה באמצעות CLI של gcloud, מגדירים את משתני הסביבה שמוגדרים כברירת מחדל ב-CLI של gcloud:

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

מחליפים את הערכים הבאים:

  • PROJECT_ID: מזהה הפרויקט ב- Cloud de Confiance.
  • REGION: u-france-east1 אזור שתומך ב-GPU מדגם H100. כאן אפשר לראות אילו מעבדי GPU זמינים בכל אזור.
  • CLUSTER_NAME: השם של האשכול.
  • GSA_NAME: השם של חשבון השירות של Google, לדוגמה, gemma-gsa.
  • KSA_NAME: השם של חשבון השירות ב-Kubernetes, לדוגמה, gemma-ksa.
  • NAMESPACE: מרחב השמות של Kubernetes, לדוגמה, default.
  • MODEL_BUCKET_NAME: השם של קטגוריית Cloud Storage שבה יישמרו משקלי המודל. השם יכול להיות זהה לשם הדגם שנבחר, למשל gemma-4-26b-it.

יצירה והגדרה של Cloud de Confiance משאבים

כדי ליצור את המשאבים הנדרשים, פועלים לפי ההוראות הבאות.

יצירת אשכול GKE ומאגר צמתים

אפשר להפעיל את Gemma במעבדים גרפיים באשכול GKE Autopilot. אשכול Autopilot מספק חוויית Kubernetes מנוהלת לחלוטין.

טייס אוטומטי

ב-CLI של gcloud, מריצים את הפקודה הבאה:

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

מחליפים את הערכים הבאים:

  • PROJECT_ID: מזהה הפרויקט ב- Cloud de Confiance.
  • CLUSTER_NAME: השם של האשכול.
  • REGION: האזור שבו נמצא האשכול.

‫GKE יוצר אשכול Autopilot עם צמתים של מעבד ו-GPU לפי הבקשה של עומסי העבודה שנפרסו.

יצירת קטגוריה של Cloud Storage

  1. ב-CLI של gcloud, מריצים את הפקודה הבאה:

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

    פעולה זו יוצרת קטגוריה של Cloud Storage לאחסון קובצי המודל שהורדתם מ-Hugging Face.

  2. הורדה והעלאה של משקלי המודל:

    צריך להשיג את משקלי המודל של Gemma לגרסאות שרוצים להכניס לשימוש בסביבת הייצור (למשל מ-Hugging Face או ממקורות רשמיים אחרים). לארגן את הקבצים שהורדתם בספריות באופן מקומי. לדוגמה:

    • ./gemma-4-26b-it-local/ (שמכיל את כל הקבצים של מודל ה-IT‏ 26B)
    • ./gemma-4-31b-it-local/ (שמכיל את כל הקבצים של מודל ה-IT‏ 31B)

    מעלים את הספריות האלה לקטגוריה של Cloud Storage עם הקידומות הספציפיות שצפויות במניפסטים של הפריסה:

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

    מבנה הפקודה הזה מבטיח שקובצי המודל ימוקמו בנתיבים כמו gs://${MODEL_BUCKET_NAME}/config.json וכו'.

הגדרת Workload Identity לגישה ל-Cloud Storage

כדי לאפשר לקבוצות ה-Pod של Kubernetes לגשת באופן מאובטח לקטגוריית Cloud Storage שמכילה את משקלי המודל, צריך להגדיר את Workload Identity ב-GKE.

  1. יוצרים את חשבון השירות של Google ‏ (GSA):

    gcloud iam service-accounts create ${GSA_NAME} \
      --project=${PROJECT_ID}
    
  2. קביעה וייצוא של אימייל GSA:

    הפורמט של כתובת האימייל תלוי בהיקף של ${PROJECT_ID} (אם הוא מכיל נקודתיים).

    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. יוצרים את חשבון השירות של Kubernetes ‏ (KSA):

    הידע, הכישורים והיכולות האלה מופיעים במניפסט הפריסה שלכם.

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

    אימות היצירה

    kubectl get serviceaccounts --namespace ${NAMESPACE}
    
  4. מוסיפים הערות ל-KSA כדי לקשר אותו ל-GSA:

    ההערה הזו מציינת ל-GKE את חשבון ה-GSA שחשבון ה-KSA יכול להתחזות אליו.

    kubectl annotate serviceaccount ${KSA_NAME} \
      --namespace ${NAMESPACE} \
      iam.gke.io/gcp-service-account=${GSA_EMAIL}
    
  5. נותנים ל-KSA הרשאה להתחזות ל-GSA:

    הקישור הזה של IAM ב-GSA מאפשר ל-KSA לפעול כ-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. נותנים ל-GSA הרשאת קריאה מהקטגוריה:

    מקצים ל-GSA את התפקיד storage.objectViewer בקטגוריה.

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

פריסת מודלים של Gemma 4 ב-vLLM

כדי לפרוס מודלים של Gemma 4, צריך ליצור קטגוריות של Cloud Storage לכל מודל כדי לאחסן את משקלי המודל, ולהחיל מניפסט של פריסת Kubernetes לגודל המודל שנבחר. פריסה היא אובייקט Kubernetes API שמאפשר להפעיל כמה רפליקות של Pods שמפוזרות בין הצמתים באשכול.

התהליך

החלת המניפסט הזה מושכת את קובץ האימג' של הקונטיינר של vLLM, מבקשת GPU של NVIDIA ומתחברת אוטומטית למשקלי המודל מקטגוריות של Cloud Storage כדי להפעיל את מנוע ההסקה של vLLM.

Gemma 4 26B-A4B-it

כדי לפרוס את מודל Gemma 4 26B-A4B שעבר כוונון להוראות, פועלים לפי ההוראות הבאות.

  1. יוצרים את קובץ המניפסט 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"
            - "--enable-log-requests"
            - "--enable-chunked-prefill"
            - "--enable-prefix-caching"
            - "--enable-auto-tool-choice"
            - "--generation-config=auto"
            - "--dtype=bfloat16"
            - "--max-num-seqs=16"
            - "--max-model-len=16384"
            - "--gpu-memory-utilization=0.95"
            - "--limit_mm_per_prompt.image=1"
            - "--tool-call-parser=gemma4"
            - "--reasoning-parser=gemma4"
            - "--trust-remote-code"
            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. החלת המניפסט:

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

    אם רוצים, אפשר להגביל את גודל חלון ההקשר ל-16K באמצעות האפשרות --max-model-len=16384 של vLLM. אם אתם רוצים להגדיל את גודל חלון ההקשר (עד 128K), אתם צריכים לשנות את ההגדרה של קובץ המניפסט ושל מאגר הצמתים כדי להגדיל את קיבולת ה-GPU.

Gemma 4 31B-it

כדי לפרוס את מודל Gemma 4 31B שעבר כוונון להוראות, פועלים לפי ההוראות הבאות.

  1. יוצרים את קובץ המניפסט 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"
            - "--enable-log-requests"
            - "--enable-chunked-prefill"
            - "--enable-prefix-caching"
            - "--enable-auto-tool-choice"
            - "--generation-config=auto"
            - "--dtype=bfloat16"
            - "--max-model-len=16384"
            - "--max-num-seqs=16"
            - "--gpu-memory-utilization=0.95"
            - "--trust-remote-code"
            - "--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. החלת המניפסט:

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

    בדוגמה שלנו, אנחנו מגבילים את גודל חלון ההקשר ל-16K באמצעות האפשרות --max-model-len=16384 של vLLM. אם רוצים להגדיל את גודל חלון ההקשר (עד 128K), צריך לשנות את קובץ המניפסט ואת ההגדרה של מאגר הצמתים כדי להגדיל את קיבולת ה-GPU.

אימות

  1. ממתינים עד שהפריסה תהיה זמינה:

    kubectl wait --for=condition=Available --timeout=1800s deployment/vllm-gemma-deployment
    
  2. צפייה ביומנים מהפריסה הפעילה:

    kubectl logs -f -l app=gemma-server
    

    משאב הפריסה מוריד את נתוני המודל של Gemma. התהליך הזה יכול לקחת כמה דקות. הפלט אמור להיראות כך:

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

אחרי שהפריסה זמינה, מגדירים העברת יציאות כדי ליצור אינטראקציה עם המודל.

פרסום המודל

בקטע הזה אתם מנהלים אינטראקציה עם המודל. לפני שממשיכים, צריך לוודא שהמודל הורד במלואו.

הגדרת העברה ליציאה אחרת

מריצים את הפקודה הבאה כדי להגדיר העברת נתונים (פורט פורוורדינג) למודל:

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

הפלט אמור להיראות כך:

Forwarding from 127.0.0.1:8080 -> 8080

אינטראקציה עם המודל באמצעות curl

בקטע הזה מוסבר איך לבצע בדיקת עשן בסיסית כדי לאמת את מודלי Gemma 4 שעברו כוונון להוראות. במודלים אחרים, מחליפים את gemma-4-26B-A4B-it בשם המודל הרלוונטי.

בדוגמה הזו תוכלו לראות איך בודקים את המודל Gemma 4 26B שעבר כוונון לפי הוראות, עם קלט של טקסט בלבד.

בסשן חדש של מסוף, משתמשים ב-curl כדי לשוחח עם המודל:

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

הפלט אמור להיראות כך:

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

פתרון בעיות

מעקב אחר ביצועי המודל

כדי לראות את לוחות הבקרה של מדדי יכולת הצפייה של מודל, פועלים לפי השלבים הבאים:

  1. במסוף Cloud de Confiance , נכנסים לדף Deployed Models.

    מעבר אל 'מודלים שנפרסו'

  2. כדי לראות פרטים על הפריסה הספציפית, כולל המדדים, היומנים ולוחות הבקרה שלה, לוחצים על שם המודל ברשימה.

  3. בדף פרטי המודל, לוחצים על הכרטיסייה Observability כדי להציג את לוחות הבקרה הבאים. אם מוצגת בקשה, לוחצים על הפעלה כדי להפעיל את איסוף המדדים באשכול.

    • בלוח הבקרה Infrastructure usage מוצגים מדדי השימוש.
    • בלוח הבקרה DCGM מוצגים מדדי DCGM.
    • אם אתם משתמשים ב-vLLM, לוח הבקרה Model performance זמין ומציג מדדים של ביצועי מודל vLLM.

אפשר גם לראות מדדים בשילוב של לוח הבקרה vLLM ב-Cloud Monitoring. המדדים האלה מצטברים לכל הפריסות של vLLM ללא מסננים מוגדרים מראש

‫vLLM חושף מדדים בפורמט Prometheus כברירת מחדל, כך שלא צריך להתקין כלי נוסף לייצוא נתונים. מידע על שימוש בשירות המנוהל של Google Cloud ל-Prometheus כדי לאסוף מדדים מהמודל זמין במאמר בנושא vLLM בתיעוד של Cloud Monitoring.

הסרת המשאבים

כדי להימנע מחיובים בחשבון Google Cloud בגלל השימוש במשאבים שנעשה במסגרת המדריך הזה, אפשר למחוק את הפרויקט שמכיל את המשאבים, או להשאיר את הפרויקט ולמחוק את המשאבים בנפרד.

מחיקת המשאבים שנפרסו

כדי להימנע מחיובים בחשבון Cloud de Confiance על המשאבים שיצרתם במדריך הזה, מריצים את הפקודה הבאה:

gcloud container clusters delete CLUSTER_NAME \
    --location=REGION

מחליפים את הערכים הבאים:

  • REGION: האזור של האשכול.
  • CLUSTER_NAME: השם של האשכול.

המאמרים הבאים