שלום, הדרכה בהתאמה אישית: הגדרת הפרויקט והסביבה

בדף הזה נסביר איך להגדיר את הפרויקט ב- Cloud de Confiance by S3NS כדי להשתמש ב-Gemini Enterprise Agent Platform, ואיך להוריד קוד TensorFlow לאימון. בנוסף, תורידו קוד לאפליקציית אינטרנט שמקבלת חיזויים.

המדריך הזה כולל כמה דפים:

  1. הגדרת הפרויקט והסביבה.

  2. אימון מודל בהתאמה אישית לסיווג תמונות

  3. הצגת חיזויים ממודל מותאם אישית לסיווג תמונות.

  4. פינוי מקום בפרויקט

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

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

במדריך הזה משתמשים במסוף Cloud de Confiance וב-Cloud Shell כדי ליצור אינטראקציה עם Cloud de Confiance by S3NS. במקום Cloud Shell, אתם יכולים להשתמש במעטפת Bash אחרת שמותקן בה Google Cloud CLI.

  1. 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

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

  3. Enable the Gemini Enterprise Agent Platform and Cloud Run functions APIs, if any are not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the APIs

  4. מפעילים את Cloud Shell במסוף Cloud de Confiance .

    הפעלת Cloud Shell

    בחלק התחתון של מסוף Cloud de Confiance יתחיל סשן של Cloud Shell ותופיע הודעה של שורת הפקודה. Cloud Shell היא סביבת מעטפת שבה ה-CLI של Google Cloud מותקן ומוגדרים ערכים לפרויקט הקיים. הסשן יופעל תוך כמה שניות.

  5. אם מזהה הפרויקט (PROJECT_ID Cloud de Confiance ) לא מופיע ב-Cloud Shell ((PROJECT_ID)$), מריצים את הפקודה הבאה כדי להגדיר את Cloud Shell להשתמש בפרויקט:

    gcloud config set project PROJECT_ID
    

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

יוצרים קטגוריה אזורית של Cloud Storage באזור us-central1, כדי להשתמש בה בהמשך המדריך. במהלך המדריך, תשתמשו בקטגוריה לכמה מטרות:

  • אחסון קוד אימון לשימוש של Agent Platform במשימת אימון בהתאמה אישית.
  • אחסון פריטי המידע שנוצרו במשימת האימון בהתאמה אישית.
  • לארח את אפליקציית האינטרנט שמקבלת חיזויים מנקודת הקצה של Agent Platform.

כדי ליצור את הקטגוריה של Cloud Storage, מריצים את הפקודה הבאה בסשן של Cloud Shell:

gcloud storage buckets create gs://BUCKET_NAME --project=PROJECT_ID --location=us-central1

מחליפים את מה שכתוב בשדות הבאים:

הורדת קוד לדוגמה

מורידים קוד לדוגמה לשימוש בשאר חלקי המדריך.

gcloud storage cp gs://cloud-samples-data/ai-platform/hello-custom/hello-custom-sample-v1.tar.gz - | tar -xzv

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

ls -lpR hello-custom-sample

בספרייה hello-custom-sample יש ארבעה פריטים:

  • ‫trainer/: ספרייה של קוד TensorFlow Keras לאימון המודל לסיווג פרחים.

  • ‫setup.py: קובץ תצורה לאריזת הספרייה trainer/ להפצה של קוד מקור ב-Python, שבה אפשר להשתמש ב-Agent Platform.

  • ‫function/: ספרייה של קוד Python לפונקציית Cloud Run שיכולה לקבל בקשות חיזוי מדפדפן אינטרנט ולעבד אותן מראש, לשלוח אותן ל-Agent Platform, לעבד את התגובות לחיזוי ולשלוח אותן בחזרה לדפדפן.

  • ‫webapp/: ספרייה עם קוד ותגי עיצוב לאפליקציית אינטרנט שמקבלת תחזיות לסיווג פרחים מ-Agent Platform.

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

כדי להריץ משימת אימון בהתאמה אישית ב-Agent Platform, פועלים לפי ההוראות בדף הבא במדריך הזה.