בדף הזה נסביר איך להגדיר את הפרויקט ב- Cloud de Confiance by S3NS כדי להשתמש ב-Gemini Enterprise Agent Platform, ואיך להוריד קוד TensorFlow לאימון. בנוסף, תורידו קוד לאפליקציית אינטרנט שמקבלת חיזויים.
המדריך הזה כולל כמה דפים:הגדרת הפרויקט והסביבה.
בכל דף מניחים שכבר ביצעתם את ההוראות מהדפים הקודמים של המדריך.
לפני שמתחילים
במדריך הזה משתמשים במסוף Cloud de Confiance וב-Cloud Shell כדי ליצור אינטראקציה עם Cloud de Confiance by S3NS. במקום Cloud Shell, אתם יכולים להשתמש במעטפת Bash אחרת שמותקן בה Google Cloud CLI.
-
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 theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Cloud de Confiance project.
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.enablepermission. 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.-
מפעילים את Cloud Shell במסוף Cloud de Confiance .
בחלק התחתון של מסוף Cloud de Confiance יתחיל סשן של Cloud Shell ותופיע הודעה של שורת הפקודה. Cloud Shell היא סביבת מעטפת שבה ה-CLI של Google Cloud מותקן ומוגדרים ערכים לפרויקט הקיים. הסשן יופעל תוך כמה שניות.
-
אם מזהה הפרויקט (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
מחליפים את מה שכתוב בשדות הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Cloud de Confiance .
- BUCKET_NAME: השם שבחרתם לקטגוריה. לדוגמה,
hello_custom_PROJECT_ID. מידע על הדרישות בנוגע לשמות של קטגוריות
הורדת קוד לדוגמה
מורידים קוד לדוגמה לשימוש בשאר חלקי המדריך.
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, פועלים לפי ההוראות בדף הבא במדריך הזה.