AutoML Edge-Modelle mit der Vertex AI API trainieren

Sie erstellen ein AutoML-Modell direkt in der Google Cloud Console oder erstellen eine programmatische Trainingspipeline mithilfe der API oder einer der Vertex AI-Clientbibliotheken.

Dieses Modell wird mit einem vorbereiteten Dataset erstellt, das Sie mit der Console oder der API bereitstellen. Die Vertex AI API verwendet die Elemente aus dem Dataset, um das Modell zu trainieren, zu testen und die Modellleistung zu bewerten. Prüfen Sie die Bewertungsergebnisse, passen Sie das Trainings-Dataset nach Bedarf an und erstellen Sie mithilfe des verbesserten Datasets eine neue Trainingspipeline.

Das Trainieren eines Modells kann mehrere Stunden dauern. Mit der Vertex AI API können Sie den Status des Trainings abrufen.

AutoML Edge-Trainingspipeline erstellen

Wenn Sie ein Dataset mit einem repräsentativen Satz von Trainingselementen haben, können Sie eine AutoML Edge-Trainingspipeline erstellen.

Wählen Sie einen Datentyp aus.

Bild

Wählen Sie unten den Tab für Ihr Ziel aus:

Klassifizierung

Zur Trainingszeit können Sie je nach Anwendungsfall das gewünschte AutoML Edge-Modell auswählen:

  • Niedrige Latenz (MOBILE_TF_LOW_LATENCY_1)
  • Allgemeine Zwecke (MOBILE_TF_VERSATILE_1)
  • Höhere Vorhersagequalität (MOBILE_TF_HIGH_ACCURACY_1)

Wählen Sie unten den Tab für Ihre Sprache oder Umgebung aus:

REST

Ersetzen Sie dabei folgende Werte für die Anfragedaten:

  • LOCATION: Region, in der sich das Dataset befindet und das Modell erstellt wird. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • TRAININGPIPELINE_DISPLAYNAME: erforderlich. Ein Anzeigename für die trainingPipeline.
  • DATASET_ID: Die ID-Nummer für das Dataset, das für das Training verwendet werden soll.
  • fractionSplit: Optional. Eine von mehreren möglichen ML-Aufteilungsoptionen für Ihre Daten. Für fractionSplit muss die Summe der Werte 1 ergeben. Beispiel:
    • {"trainingFraction": "0.7","validationFraction": "0.15","testFraction": "0.15"}
  • MODEL_DISPLAYNAME*: Ein Anzeigename für das von der TrainingPipeline hochgeladene (erstellte) Modell.
  • MODEL_DESCRIPTION*: Eine Beschreibung für das Modell.
  • modelToUpload.labels*: Beliebiger Satz von Schlüssel/Wert-Paaren, um Ihre Modelle zu organisieren. Beispiel:
    • "env": "prod"
    • "tier": "backend"
  • EDGE_MODELTYPE: Der Typ des zu trainierenden Edge-Modells. Folgende Optionen sind verfügbar:
    • MOBILE_TF_LOW_LATENCY_1
    • MOBILE_TF_VERSATILE_1
    • MOBILE_TF_HIGH_ACCURACY_1
  • NODE_HOUR_BUDGET: Die tatsächliche Höhe der Trainingskosten kann gleich oder kleiner als dieser Wert sein. Für Edge-Modelle muss das Budget 1.000–100.000 Milli-Knotenstunden (einschließlich) betragen.
  • PROJECT_NUMBER: Die automatisch generierte Projektnummer Ihres Projekts

HTTP-Methode und URL:

POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines

JSON-Text der Anfrage:

{
  "displayName": "TRAININGPIPELINE_DISPLAYNAME",
  "inputDataConfig": {
    "datasetId": "DATASET_ID",
    "fractionSplit": {
      "trainingFraction": "DECIMAL",
      "validationFraction": "DECIMAL",
      "testFraction": "DECIMAL"
    }
  },
  "modelToUpload": {
    "displayName": "MODEL_DISPLAYNAME",
    "description": "MODEL_DESCRIPTION",
    "labels": {
      "KEY": "VALUE"
    }
  },
  "trainingTaskDefinition": "gs://google-cloud-aiplatform/schema/trainingjob/definition/automl_image_classification_1.0.0.yaml",
  "trainingTaskInputs": {
    "multiLabel": "false",
    "modelType": ["EDGE_MODELTYPE"],
    "budgetMilliNodeHours": NODE_HOUR_BUDGET
  }
}

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines"

PowerShell

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines" | Select-Object -Expand Content

Die Antwort enthält Informationen zu Spezifikationen sowie die TRAININGPIPELINE_ID.

Sie können den Status des trainingPipeline-Jobs mit TRAININGPIPELINE_ID abrufen.

Klassifizierung

Zur Trainingszeit können Sie je nach Anwendungsfall das gewünschte AutoML Edge-Modell auswählen:

  • Niedrige Latenz (MOBILE_TF_LOW_LATENCY_1)
  • Allgemeine Zwecke (MOBILE_TF_VERSATILE_1)
  • Höhere Vorhersagequalität (MOBILE_TF_HIGH_ACCURACY_1)

Wählen Sie unten den Tab für Ihre Sprache oder Umgebung aus:

REST

Ersetzen Sie dabei folgende Werte für die Anfragedaten:

  • LOCATION: Region, in der sich das Dataset befindet und das Modell erstellt wird. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • TRAININGPIPELINE_DISPLAYNAME: erforderlich. Ein Anzeigename für die trainingPipeline.
  • DATASET_ID: Die ID-Nummer für das Dataset, das für das Training verwendet werden soll.
  • fractionSplit: Optional. Eine von mehreren möglichen ML-Aufteilungsoptionen für Ihre Daten. Für fractionSplit muss die Summe der Werte 1 ergeben. Beispiel:
    • {"trainingFraction": "0.7","validationFraction": "0.15","testFraction": "0.15"}
  • MODEL_DISPLAYNAME*: Ein Anzeigename für das von der TrainingPipeline hochgeladene (erstellte) Modell.
  • MODEL_DESCRIPTION*: Eine Beschreibung für das Modell.
  • modelToUpload.labels*: Beliebiger Satz von Schlüssel/Wert-Paaren, um Ihre Modelle zu organisieren. Beispiel:
    • "env": "prod"
    • "tier": "backend"
  • EDGE_MODELTYPE: Der Typ des zu trainierenden Edge-Modells. Folgende Optionen sind verfügbar:
    • MOBILE_TF_LOW_LATENCY_1
    • MOBILE_TF_VERSATILE_1
    • MOBILE_TF_HIGH_ACCURACY_1
  • NODE_HOUR_BUDGET: Die tatsächliche Höhe der Trainingskosten kann gleich oder kleiner als dieser Wert sein. Für Edge-Modelle muss das Budget 1.000–100.000 Milli-Knotenstunden (einschließlich) betragen.
  • PROJECT_NUMBER: Die automatisch generierte Projektnummer Ihres Projekts

HTTP-Methode und URL:

POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines

JSON-Text der Anfrage:

{
  "displayName": "TRAININGPIPELINE_DISPLAYNAME",
  "inputDataConfig": {
    "datasetId": "DATASET_ID",
    "fractionSplit": {
      "trainingFraction": "DECIMAL",
      "validationFraction": "DECIMAL",
      "testFraction": "DECIMAL"
    }
  },
  "modelToUpload": {
    "displayName": "MODEL_DISPLAYNAME",
    "description": "MODEL_DESCRIPTION",
    "labels": {
      "KEY": "VALUE"
    }
  },
  "trainingTaskDefinition": "gs://google-cloud-aiplatform/schema/trainingjob/definition/automl_image_classification_1.0.0.yaml",
  "trainingTaskInputs": {
    "multiLabel": "true",
    "modelType": ["EDGE_MODELTYPE"],
    "budgetMilliNodeHours": NODE_HOUR_BUDGET
  }
}

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines"

PowerShell

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines" | Select-Object -Expand Content

Die Antwort enthält Informationen zu Spezifikationen sowie die TRAININGPIPELINE_ID.

Sie können den Status des trainingPipeline-Jobs mit TRAININGPIPELINE_ID abrufen.

Objekterkennung

Zur Trainingszeit können Sie je nach Anwendungsfall das gewünschte AutoML Edge-Modell auswählen:

  • Niedrige Latenz (MOBILE_TF_LOW_LATENCY_1)
  • Allgemeine Zwecke (MOBILE_TF_VERSATILE_1)
  • Höhere Vorhersagequalität (MOBILE_TF_HIGH_ACCURACY_1)

Wählen Sie unten den Tab für Ihre Sprache oder Umgebung aus:

REST

Ersetzen Sie dabei folgende Werte für die Anfragedaten:

  • LOCATION: Region, in der sich das Dataset befindet und das Modell erstellt wird. Beispiel: us-central1.
  • PROJECT: Ihre Projekt-ID.
  • TRAININGPIPELINE_DISPLAYNAME: erforderlich. Ein Anzeigename für die trainingPipeline.
  • DATASET_ID: Die ID-Nummer für das Dataset, das für das Training verwendet werden soll.
  • fractionSplit: Optional. Eine von mehreren möglichen ML-Aufteilungsoptionen für Ihre Daten. Für fractionSplit muss die Summe der Werte 1 ergeben. Beispiel:
    • {"trainingFraction": "0.7","validationFraction": "0.15","testFraction": "0.15"}
  • MODEL_DISPLAYNAME*: Ein Anzeigename für das von der TrainingPipeline hochgeladene (erstellte) Modell.
  • MODEL_DESCRIPTION*: Eine Beschreibung für das Modell.
  • modelToUpload.labels*: Beliebiger Satz von Schlüssel/Wert-Paaren, um Ihre Modelle zu organisieren. Beispiel:
    • "env": "prod"
    • "tier": "backend"
  • EDGE_MODELTYPE: Der Typ des zu trainierenden Edge-Modells. Folgende Optionen sind verfügbar:
    • MOBILE_TF_LOW_LATENCY_1
    • MOBILE_TF_VERSATILE_1
    • MOBILE_TF_HIGH_ACCURACY_1
  • NODE_HOUR_BUDGET: Die tatsächliche Höhe der Trainingskosten kann gleich oder kleiner als dieser Wert sein. Für Cloud-Modelle muss das Budget folgenden Wert betragen: 20.000 - 900.000 Milli-Knotenstunden (einschließlich). Der Standardwert ist 216.000, was einem Tag in Echtzeit entspricht, wobei 9 Knoten verwendet werden.
  • PROJECT_NUMBER: Die automatisch generierte Projektnummer Ihres Projekts

HTTP-Methode und URL:

POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines

JSON-Text der Anfrage:

{
  "displayName": "TRAININGPIPELINE_DISPLAYNAME",
  "inputDataConfig": {
    "datasetId": "DATASET_ID",
    "fractionSplit": {
      "trainingFraction": "DECIMAL",
      "validationFraction": "DECIMAL",
      "testFraction": "DECIMAL"
    }
  },
  "modelToUpload": {
    "displayName": "MODEL_DISPLAYNAME",
    "description": "MODEL_DESCRIPTION",
    "labels": {
      "KEY": "VALUE"
    }
  },
  "trainingTaskDefinition": "gs://google-cloud-aiplatform/schema/trainingjob/definition/automl_image_object_detection_1.0.0.yaml",
  "trainingTaskInputs": {
    "modelType": ["EDGE_MODELTYPE"],
    "budgetMilliNodeHours": NODE_HOUR_BUDGET
  }
}

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines"

PowerShell

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines" | Select-Object -Expand Content

Die Antwort enthält Informationen zu Spezifikationen sowie die TRAININGPIPELINE_ID.

Sie können den Status des trainingPipeline-Jobs mit TRAININGPIPELINE_ID abrufen.

Video

Wählen Sie unten den Tab für Ihr Ziel aus:

Aktionserkennung

Wählen Sie während des Trainings den folgenden AutoML-Edge-Typ aus:

  • MOBILE_VERSATILE_1: Allgemeine Zwecke

REST

Ersetzen Sie dabei folgende Werte für die Anfragedaten:

  • PROJECT: Ihre Projekt-ID.
  • LOCATION: Region, in der sich das Dataset befindet und das Modell erstellt wird. Beispiel: us-central1.
  • TRAINING_PIPELINE_DISPLAY_NAME: erforderlich. Ein Anzeigename für die TrainingPipeline.
  • DATASET_ID: ID für das Trainings-Dataset.
  • TRAINING_FRACTION, TEST_FRACTION: Das Objekt fractionSplit ist optional. Es dient dazu, die Datenaufteilung zu steuern. Weitere Informationen zur Datenaufteilung finden Sie unter Datenaufteilungen für AutoML-Modelle. Beispiel:
    • {"trainingFraction": "0.8","validationFraction": "0","testFraction": "0.2"}
  • MODEL_DISPLAY_NAME: Anzeigename des trainierten Modells.
  • MODEL_DESCRIPTION: Eine Beschreibung für das Modell.
  • MODEL_LABELS: Beliebiger Satz von Schlüssel/Wert-Paaren zum Organisieren Ihrer Modelle. Beispiel:
    • "env": "prod"
    • "tier": "backend"
  • EDGE_MODEL_TYPE:
    • MOBILE_VERSATILE_1: Allgemeine Zwecke
  • PROJECT_NUMBER: Die automatisch generierte Projektnummer Ihres Projekts

HTTP-Methode und URL:

POST https://LOCATION-aiplatform.googleapis.com/beta1/projects/PROJECT/locations/LOCATION/trainingPipelines

JSON-Text der Anfrage:

{
  "displayName": "TRAINING_PIPELINE_DISPLAY_NAME",
  "inputDataConfig": {
    "datasetId": "DATASET_ID",
    "fractionSplit": {
      "trainingFraction": "TRAINING_FRACTION",
      "validationFraction": "0",
      "testFraction": "TEST_FRACTION"
    }
  },
  "modelToUpload": {
    "displayName": "MODEL_DISPLAY_NAME",
    "description": "MODEL_DESCRIPTION",
    "labels": {
      "KEY": "VALUE"
    }
  },
  "trainingTaskDefinition": "gs://google-cloud-aiplatform/schema/trainingjob/definition/automl_video_action_recognition_1.0.0.yaml",
  "trainingTaskInputs": {
    "modelType": ["EDGE_MODEL_TYPE"],
  }
}

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-aiplatform.googleapis.com/beta1/projects/PROJECT/locations/LOCATION/trainingPipelines"

PowerShell

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION-aiplatform.googleapis.com/beta1/projects/PROJECT/locations/LOCATION/trainingPipelines" | Select-Object -Expand Content

Die Antwort enthält Informationen zu Spezifikationen sowie die TRAININGPIPELINE_ID.

Sie können den Status des Fortschritts der Trainingspipeline abrufen, um zu sehen, wann sie abgeschlossen ist.

Klassifizierung

Wählen Sie während des Trainings den folgenden AutoML-Edge-Typ aus:

  • MOBILE_VERSATILE_1: Allgemeine Zwecke

REST

Ersetzen Sie dabei folgende Werte für die Anfragedaten:

  • PROJECT: Ihre Projekt-ID.
  • LOCATION: Region, in der sich das Dataset befindet und das Modell erstellt wird. Beispiel: us-central1.
  • TRAINING_PIPELINE_DISPLAY_NAME: erforderlich. Ein Anzeigename für die TrainingPipeline.
  • DATASET_ID: ID für das Trainings-Dataset.
  • TRAINING_FRACTION, TEST_FRACTION: Das Objekt fractionSplit ist optional. Es dient dazu, die Datenaufteilung zu steuern. Weitere Informationen zur Datenaufteilung finden Sie unter Datenaufteilungen für AutoML-Modelle. Beispiel:
    • {"trainingFraction": "0.8","validationFraction": "0","testFraction": "0.2"}
  • MODEL_DISPLAY_NAME: Anzeigename des trainierten Modells.
  • MODEL_DESCRIPTION: Eine Beschreibung für das Modell.
  • MODEL_LABELS: Beliebiger Satz von Schlüssel/Wert-Paaren zum Organisieren Ihrer Modelle. Beispiel:
    • "env": "prod"
    • "tier": "backend"
  • EDGE_MODEL_TYPE:
    • MOBILE_VERSATILE_1: Allgemeine Zwecke
  • PROJECT_NUMBER: Die automatisch generierte Projektnummer Ihres Projekts

HTTP-Methode und URL:

POST https://LOCATION-aiplatform.googleapis.com/beta1/projects/PROJECT/locations/LOCATION/trainingPipelines

JSON-Text der Anfrage:

{
  "displayName": "TRAINING_PIPELINE_DISPLAY_NAME",
  "inputDataConfig": {
    "datasetId": "DATASET_ID",
    "fractionSplit": {
      "trainingFraction": "TRAINING_FRACTION",
      "validationFraction": "0",
      "testFraction": "TEST_FRACTION"
    }
  },
  "modelToUpload": {
    "displayName": "MODEL_DISPLAY_NAME",
    "description": "MODEL_DESCRIPTION",
    "labels": {
      "KEY": "VALUE"
    }
  },
  "trainingTaskDefinition": "gs://google-cloud-aiplatform/schema/trainingjob/definition/automl_video_classification_1.0.0.yaml",
  "trainingTaskInputs": {
    "modelType": ["EDGE_MODEL_TYPE"],
  }
}

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-aiplatform.googleapis.com/beta1/projects/PROJECT/locations/LOCATION/trainingPipelines"

PowerShell

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION-aiplatform.googleapis.com/beta1/projects/PROJECT/locations/LOCATION/trainingPipelines" | Select-Object -Expand Content

Die Antwort enthält Informationen zu Spezifikationen sowie die TRAININGPIPELINE_ID.

Sie können den Status des Fortschritts der Trainingspipeline abrufen, um zu sehen, wann sie abgeschlossen ist.

Objekt-Tracking

Wählen Sie während des Trainings den AutoML-Edge-Typ aus:

  • MOBILE_VERSATILE_1: Allgemeine Zwecke
  • MOBILE_CORAL_VERSATILE_1: höhere Vorhersagequalität für Google Coral
  • MOBILE_CORAL_LOW_LATENCY_1: niedrigere Latenz für Google Coral
  • MOBILE_JETSON_VERSATILE_1: höhere Vorhersagequalität für NVIDIA Jetson
  • MOBILE_JETSON_LOW_LATENCY_1: geringere Latenz für NVIDIA Jetson

REST

Ersetzen Sie dabei folgende Werte für die Anfragedaten:

  • PROJECT: Ihre Projekt-ID.
  • LOCATION: Region, in der sich das Dataset befindet und das Modell erstellt wird. Beispiel: us-central1.
  • TRAINING_PIPELINE_DISPLAY_NAME: erforderlich. Ein Anzeigename für die TrainingPipeline.
  • DATASET_ID: ID für das Trainings-Dataset.
  • TRAINING_FRACTION, TEST_FRACTION: Das Objekt fractionSplit ist optional. Es dient dazu, die Datenaufteilung zu steuern. Weitere Informationen zur Datenaufteilung finden Sie unter Datenaufteilungen für AutoML-Modelle. Beispiel:
    • {"trainingFraction": "0.8","validationFraction": "0","testFraction": "0.2"}
  • MODEL_DISPLAY_NAME: Anzeigename des trainierten Modells.
  • MODEL_DESCRIPTION: Eine Beschreibung für das Modell.
  • MODEL_LABELS: Beliebiger Satz von Schlüssel/Wert-Paaren zum Organisieren Ihrer Modelle. Beispiel:
    • "env": "prod"
    • "tier": "backend"
  • EDGE_MODEL_TYPE: einer der folgenden:
    • MOBILE_VERSATILE_1: Allgemeine Zwecke
    • MOBILE_CORAL_VERSATILE_1: höhere Vorhersagequalität für Google Coral
    • MOBILE_CORAL_LOW_LATENCY_1: niedrigere Latenz für Google Coral
    • MOBILE_JETSON_VERSATILE_1: höhere Vorhersagequalität für NVIDIA Jetson
    • MOBILE_JETSON_LOW_LATENCY_1: geringere Latenz für NVIDIA Jetson
  • PROJECT_NUMBER: Die automatisch generierte Projektnummer Ihres Projekts

HTTP-Methode und URL:

POST https://LOCATION-aiplatform.googleapis.com/beta1/projects/PROJECT/locations/LOCATION/trainingPipelines

JSON-Text der Anfrage:

{
  "displayName": "TRAINING_PIPELINE_DISPLAY_NAME",
  "inputDataConfig": {
    "datasetId": "DATASET_ID",
    "fractionSplit": {
      "trainingFraction": "TRAINING_FRACTION",
      "validationFraction": "0",
      "testFraction": "TEST_FRACTION"
    }
  },
  "modelToUpload": {
    "displayName": "MODEL_DISPLAY_NAME",
    "description": "MODEL_DESCRIPTION",
    "labels": {
      "KEY": "VALUE"
    }
  },
  "trainingTaskDefinition": "gs://google-cloud-aiplatform/schema/trainingjob/definition/automl_video_object_tracking_1.0.0.yaml",
  "trainingTaskInputs": {
    "modelType": ["EDGE_MODEL_TYPE"],
  }
}

Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:

curl

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-aiplatform.googleapis.com/beta1/projects/PROJECT/locations/LOCATION/trainingPipelines"

PowerShell

Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION-aiplatform.googleapis.com/beta1/projects/PROJECT/locations/LOCATION/trainingPipelines" | Select-Object -Expand Content

Die Antwort enthält Informationen zu Spezifikationen sowie die TRAININGPIPELINE_ID.

Sie können den Status des Fortschritts der Trainingspipeline abrufen, um zu sehen, wann sie abgeschlossen ist.

trainingPipeline-Status abrufen

Verwenden Sie den folgenden Code, um den Status der trainingPipeline-Erstellung programmatisch abzurufen.

REST

Ersetzen Sie dabei folgende Werte für die Anfragedaten:

  • LOCATION: Region, in der sich die TrainingPipeline befindet.
  • PROJECT: Ihre Projekt-ID.
  • TRAININGPIPELINE_ID: Die ID der spezifischen TrainingPipeline.
  • PROJECT_NUMBER: Die automatisch generierte Projektnummer Ihres Projekts

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines/TRAININGPIPELINE_ID

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie folgenden Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines/TRAININGPIPELINE_ID"

PowerShell

Führen Sie folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/trainingPipelines/TRAININGPIPELINE_ID" | Select-Object -Expand Content

Das Feld "state" zeigt den aktuellen Status des Vorgangs an.

Die Ausgabe für einen abgeschlossenen Vorgang zum Erstellen der trainingPipeline sollte in etwa so aussehen:

Java

Bevor Sie dieses Beispiel anwenden, folgen Sie den Java-Einrichtungsschritten in der Vertex AI-Kurzanleitung zur Verwendung von Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.

Richten Sie zur Authentifizierung bei Vertex AI Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.


import com.google.cloud.aiplatform.v1.DeployedModelRef;
import com.google.cloud.aiplatform.v1.EnvVar;
import com.google.cloud.aiplatform.v1.FilterSplit;
import com.google.cloud.aiplatform.v1.FractionSplit;
import com.google.cloud.aiplatform.v1.InputDataConfig;
import com.google.cloud.aiplatform.v1.Model;
import com.google.cloud.aiplatform.v1.ModelContainerSpec;
import com.google.cloud.aiplatform.v1.PipelineServiceClient;
import com.google.cloud.aiplatform.v1.PipelineServiceSettings;
import com.google.cloud.aiplatform.v1.Port;
import com.google.cloud.aiplatform.v1.PredefinedSplit;
import com.google.cloud.aiplatform.v1.PredictSchemata;
import com.google.cloud.aiplatform.v1.TimestampSplit;
import com.google.cloud.aiplatform.v1.TrainingPipeline;
import com.google.cloud.aiplatform.v1.TrainingPipelineName;
import com.google.rpc.Status;
import java.io.IOException;

public class GetTrainingPipelineSample {
  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String project = "YOUR_PROJECT_ID";
    String trainingPipelineId = "YOUR_TRAINING_PIPELINE_ID";
    getTrainingPipeline(project, trainingPipelineId);
  }

  static void getTrainingPipeline(String project, String trainingPipelineId) throws IOException {
    PipelineServiceSettings pipelineServiceSettings =
        PipelineServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (PipelineServiceClient pipelineServiceClient =
        PipelineServiceClient.create(pipelineServiceSettings)) {
      String location = "us-central1";
      TrainingPipelineName trainingPipelineName =
          TrainingPipelineName.of(project, location, trainingPipelineId);

      TrainingPipeline trainingPipelineResponse =
          pipelineServiceClient.getTrainingPipeline(trainingPipelineName);

      System.out.println("Get Training Pipeline Response");
      System.out.format("\tName: %s\n", trainingPipelineResponse.getName());
      System.out.format("\tDisplay Name: %s\n", trainingPipelineResponse.getDisplayName());
      System.out.format(
          "\tTraining Task Definition: %s\n", trainingPipelineResponse.getTrainingTaskDefinition());
      System.out.format(
          "\tTraining Task Inputs: %s\n", trainingPipelineResponse.getTrainingTaskInputs());
      System.out.format(
          "\tTraining Task Metadata: %s\n", trainingPipelineResponse.getTrainingTaskMetadata());
      System.out.format("\tState: %s\n", trainingPipelineResponse.getState());
      System.out.format("\tCreate Time: %s\n", trainingPipelineResponse.getCreateTime());
      System.out.format("\tStart Time: %s\n", trainingPipelineResponse.getStartTime());
      System.out.format("\tEnd Time: %s\n", trainingPipelineResponse.getEndTime());
      System.out.format("\tUpdate Time: %s\n", trainingPipelineResponse.getUpdateTime());
      System.out.format("\tLabels: %s\n", trainingPipelineResponse.getLabelsMap());
      InputDataConfig inputDataConfig = trainingPipelineResponse.getInputDataConfig();

      System.out.println("\tInput Data Config");
      System.out.format("\t\tDataset Id: %s\n", inputDataConfig.getDatasetId());
      System.out.format("\t\tAnnotations Filter: %s\n", inputDataConfig.getAnnotationsFilter());
      FractionSplit fractionSplit = inputDataConfig.getFractionSplit();

      System.out.println("\t\tFraction Split");
      System.out.format("\t\t\tTraining Fraction: %s\n", fractionSplit.getTrainingFraction());
      System.out.format("\t\t\tValidation Fraction: %s\n", fractionSplit.getValidationFraction());
      System.out.format("\t\t\tTest Fraction: %s\n", fractionSplit.getTestFraction());
      FilterSplit filterSplit = inputDataConfig.getFilterSplit();

      System.out.println("\t\tFilter Split");
      System.out.format("\t\t\tTraining Filter: %s\n", filterSplit.getTrainingFilter());
      System.out.format("\t\t\tValidation Filter: %s\n", filterSplit.getValidationFilter());
      System.out.format("\t\t\tTest Filter: %s\n", filterSplit.getTestFilter());
      PredefinedSplit predefinedSplit = inputDataConfig.getPredefinedSplit();

      System.out.println("\t\tPredefined Split");
      System.out.format("\t\t\tKey: %s\n", predefinedSplit.getKey());
      TimestampSplit timestampSplit = inputDataConfig.getTimestampSplit();

      System.out.println("\t\tTimestamp Split");
      System.out.format("\t\t\tTraining Fraction: %s\n", timestampSplit.getTrainingFraction());
      System.out.format("\t\t\tTest Fraction: %s\n", timestampSplit.getTestFraction());
      System.out.format("\t\t\tValidation Fraction: %s\n", timestampSplit.getValidationFraction());
      System.out.format("\t\t\tKey: %s\n", timestampSplit.getKey());
      Model modelResponse = trainingPipelineResponse.getModelToUpload();

      System.out.println("\t\tModel to upload");
      System.out.format("\t\tName: %s\n", modelResponse.getName());
      System.out.format("\t\tDisplay Name: %s\n", modelResponse.getDisplayName());
      System.out.format("\t\tDescription: %s\n", modelResponse.getDescription());
      System.out.format("\t\tMetadata Schema Uri: %s\n", modelResponse.getMetadataSchemaUri());
      System.out.format("\t\tMeta Data: %s\n", modelResponse.getMetadata());
      System.out.format("\t\tTraining Pipeline: %s\n", modelResponse.getTrainingPipeline());
      System.out.format("\t\tArtifact Uri: %s\n", modelResponse.getArtifactUri());
      System.out.format(
          "\t\tSupported Deployment Resources Types: %s\n",
          modelResponse.getSupportedDeploymentResourcesTypesList().toString());
      System.out.format(
          "\t\tSupported Input Storage Formats: %s\n",
          modelResponse.getSupportedInputStorageFormatsList().toString());
      System.out.format(
          "\t\tSupported Output Storage Formats: %s\n",
          modelResponse.getSupportedOutputStorageFormatsList().toString());
      System.out.format("\t\tCreate Time: %s\n", modelResponse.getCreateTime());
      System.out.format("\t\tUpdate Time: %s\n", modelResponse.getUpdateTime());
      System.out.format("\t\tLabels: %s\n", modelResponse.getLabelsMap());
      PredictSchemata predictSchemata = modelResponse.getPredictSchemata();

      System.out.println("\tPredict Schemata");
      System.out.format("\t\tInstance Schema Uri: %s\n", predictSchemata.getInstanceSchemaUri());
      System.out.format(
          "\t\tParameters Schema Uri: %s\n", predictSchemata.getParametersSchemaUri());
      System.out.format(
          "\t\tPrediction Schema Uri: %s\n", predictSchemata.getPredictionSchemaUri());

      for (Model.ExportFormat supportedExportFormat :
          modelResponse.getSupportedExportFormatsList()) {
        System.out.println("\tSupported Export Format");
        System.out.format("\t\tId: %s\n", supportedExportFormat.getId());
      }
      ModelContainerSpec containerSpec = modelResponse.getContainerSpec();

      System.out.println("\tContainer Spec");
      System.out.format("\t\tImage Uri: %s\n", containerSpec.getImageUri());
      System.out.format("\t\tCommand: %s\n", containerSpec.getCommandList());
      System.out.format("\t\tArgs: %s\n", containerSpec.getArgsList());
      System.out.format("\t\tPredict Route: %s\n", containerSpec.getPredictRoute());
      System.out.format("\t\tHealth Route: %s\n", containerSpec.getHealthRoute());

      for (EnvVar envVar : containerSpec.getEnvList()) {
        System.out.println("\t\tEnv");
        System.out.format("\t\t\tName: %s\n", envVar.getName());
        System.out.format("\t\t\tValue: %s\n", envVar.getValue());
      }

      for (Port port : containerSpec.getPortsList()) {
        System.out.println("\t\tPort");
        System.out.format("\t\t\tContainer Port: %s\n", port.getContainerPort());
      }

      for (DeployedModelRef deployedModelRef : modelResponse.getDeployedModelsList()) {
        System.out.println("\tDeployed Model");
        System.out.format("\t\tEndpoint: %s\n", deployedModelRef.getEndpoint());
        System.out.format("\t\tDeployed Model Id: %s\n", deployedModelRef.getDeployedModelId());
      }

      Status status = trainingPipelineResponse.getError();
      System.out.println("\tError");
      System.out.format("\t\tCode: %s\n", status.getCode());
      System.out.format("\t\tMessage: %s\n", status.getMessage());
    }
  }
}

Python

Informationen zur Installation des Vertex AI SDK for Python finden Sie unter Vertex AI SDK for Python installieren. Weitere Informationen finden Sie in der Referenzdokumentation zur Python API.

from google.cloud import aiplatform

def get_training_pipeline_sample(
    project: str,
    training_pipeline_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.PipelineServiceClient(client_options=client_options)
    name = client.training_pipeline_path(
        project=project, location=location, training_pipeline=training_pipeline_id
    )
    response = client.get_training_pipeline(name=name)
    print("response:", response)

Modellinformationen abrufen

Nachdem die trainingPipeline-Erstellung abgeschlossen ist, können Sie den Anzeigenamen des Modells verwenden, um detailliertere Modellinformationen zu erhalten.

REST

Ersetzen Sie dabei folgende Werte für die Anfragedaten:

  • LOCATION: Region, in der sich das Modell befindet. z. B. us-central1.
  • PROJECT: Ihre Projekt-ID.
  • MODEL_DISPLAYNAME: Der Anzeigename Ihres Modells, dem Sie beim Erstellen eines Trainingsjobs angegeben haben.
  • PROJECT_NUMBER: Die automatisch generierte Projektnummer Ihres Projekts

HTTP-Methode und URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models?filter=display_name=MODEL_DISPLAYNAME

Senden Sie die Anfrage mithilfe einer der folgenden Optionen:

curl

Führen Sie folgenden Befehl aus:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models?filter=display_name=MODEL_DISPLAYNAME "

PowerShell

Führen Sie folgenden Befehl aus:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models?filter=display_name=MODEL_DISPLAYNAME " | Select-Object -Expand Content

Die Ausgabe für ein trainiertes AutoML Edge-Modell sollte in etwa so aussehen: Die folgende Beispielausgabe bezieht sich auf ein AutoML Edge-Bildmodell:

Java

Bevor Sie dieses Beispiel anwenden, folgen Sie den Java-Einrichtungsschritten in der Vertex AI-Kurzanleitung zur Verwendung von Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Java API.

Richten Sie zur Authentifizierung bei Vertex AI Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.


import com.google.cloud.aiplatform.v1.DeployedModelRef;
import com.google.cloud.aiplatform.v1.EnvVar;
import com.google.cloud.aiplatform.v1.Model;
import com.google.cloud.aiplatform.v1.Model.ExportFormat;
import com.google.cloud.aiplatform.v1.ModelContainerSpec;
import com.google.cloud.aiplatform.v1.ModelName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import com.google.cloud.aiplatform.v1.Port;
import com.google.cloud.aiplatform.v1.PredictSchemata;
import java.io.IOException;

public class GetModelSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    getModelSample(project, modelId);
  }

  static void getModelSample(String project, String modelId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelName modelName = ModelName.of(project, location, modelId);

      Model modelResponse = modelServiceClient.getModel(modelName);
      System.out.println("Get Model response");
      System.out.format("\tName: %s\n", modelResponse.getName());
      System.out.format("\tDisplay Name: %s\n", modelResponse.getDisplayName());
      System.out.format("\tDescription: %s\n", modelResponse.getDescription());

      System.out.format("\tMetadata Schema Uri: %s\n", modelResponse.getMetadataSchemaUri());
      System.out.format("\tMetadata: %s\n", modelResponse.getMetadata());
      System.out.format("\tTraining Pipeline: %s\n", modelResponse.getTrainingPipeline());
      System.out.format("\tArtifact Uri: %s\n", modelResponse.getArtifactUri());

      System.out.format(
          "\tSupported Deployment Resources Types: %s\n",
          modelResponse.getSupportedDeploymentResourcesTypesList());
      System.out.format(
          "\tSupported Input Storage Formats: %s\n",
          modelResponse.getSupportedInputStorageFormatsList());
      System.out.format(
          "\tSupported Output Storage Formats: %s\n",
          modelResponse.getSupportedOutputStorageFormatsList());

      System.out.format("\tCreate Time: %s\n", modelResponse.getCreateTime());
      System.out.format("\tUpdate Time: %s\n", modelResponse.getUpdateTime());
      System.out.format("\tLabels: %s\n", modelResponse.getLabelsMap());

      PredictSchemata predictSchemata = modelResponse.getPredictSchemata();
      System.out.println("\tPredict Schemata");
      System.out.format("\t\tInstance Schema Uri: %s\n", predictSchemata.getInstanceSchemaUri());
      System.out.format(
          "\t\tParameters Schema Uri: %s\n", predictSchemata.getParametersSchemaUri());
      System.out.format(
          "\t\tPrediction Schema Uri: %s\n", predictSchemata.getPredictionSchemaUri());

      for (ExportFormat exportFormat : modelResponse.getSupportedExportFormatsList()) {
        System.out.println("\tSupported Export Format");
        System.out.format("\t\tId: %s\n", exportFormat.getId());
      }

      ModelContainerSpec containerSpec = modelResponse.getContainerSpec();
      System.out.println("\tContainer Spec");
      System.out.format("\t\tImage Uri: %s\n", containerSpec.getImageUri());
      System.out.format("\t\tCommand: %s\n", containerSpec.getCommandList());
      System.out.format("\t\tArgs: %s\n", containerSpec.getArgsList());
      System.out.format("\t\tPredict Route: %s\n", containerSpec.getPredictRoute());
      System.out.format("\t\tHealth Route: %s\n", containerSpec.getHealthRoute());

      for (EnvVar envVar : containerSpec.getEnvList()) {
        System.out.println("\t\tEnv");
        System.out.format("\t\t\tName: %s\n", envVar.getName());
        System.out.format("\t\t\tValue: %s\n", envVar.getValue());
      }

      for (Port port : containerSpec.getPortsList()) {
        System.out.println("\t\tPort");
        System.out.format("\t\t\tContainer Port: %s\n", port.getContainerPort());
      }

      for (DeployedModelRef deployedModelRef : modelResponse.getDeployedModelsList()) {
        System.out.println("\tDeployed Model");
        System.out.format("\t\tEndpoint: %s\n", deployedModelRef.getEndpoint());
        System.out.format("\t\tDeployed Model Id: %s\n", deployedModelRef.getDeployedModelId());
      }
    }
  }
}

Node.js

Bevor Sie dieses Beispiel anwenden, folgen Sie den Node.js-Einrichtungsschritten in der Vertex AI-Kurzanleitung zur Verwendung von Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Vertex AI Node.js API.

Richten Sie zur Authentifizierung bei Vertex AI Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

/**
 * TODO(developer): Uncomment these variables before running the sample.\
 * (Not necessary if passing values as arguments)
 */

// const modelId = 'YOUR_MODEL_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModel() {
  // Configure the parent resource
  const name = `projects/${project}/locations/${location}/models/${modelId}`;
  const request = {
    name,
  };
  // Get and print out a list of all the endpoints for this resource
  const [response] = await modelServiceClient.getModel(request);

  console.log('Get model response');
  console.log(`\tName : ${response.name}`);
  console.log(`\tDisplayName : ${response.displayName}`);
  console.log(`\tDescription : ${response.description}`);
  console.log(`\tMetadata schema uri : ${response.metadataSchemaUri}`);
  console.log(`\tMetadata : ${JSON.stringify(response.metadata)}`);
  console.log(`\tTraining pipeline : ${response.trainingPipeline}`);
  console.log(`\tArtifact uri : ${response.artifactUri}`);
  console.log(
    `\tSupported deployment resource types : \
      ${response.supportedDeploymentResourceTypes}`
  );
  console.log(
    `\tSupported input storage formats : \
      ${response.supportedInputStorageFormats}`
  );
  console.log(
    `\tSupported output storage formats : \
      ${response.supportedOutputStoragFormats}`
  );
  console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);
  console.log(`\tUpdate time : ${JSON.stringify(response.updateTime)}`);
  console.log(`\tLabels : ${JSON.stringify(response.labels)}`);

  const predictSchemata = response.predictSchemata;
  console.log('\tPredict schemata');
  console.log(`\tInstance schema uri : ${predictSchemata.instanceSchemaUri}`);
  console.log(
    `\tParameters schema uri : ${predictSchemata.prametersSchemaUri}`
  );
  console.log(
    `\tPrediction schema uri : ${predictSchemata.predictionSchemaUri}`
  );

  const [supportedExportFormats] = response.supportedExportFormats;
  console.log('\tSupported export formats');
  console.log(`\t${supportedExportFormats}`);

  const containerSpec = response.containerSpec;
  console.log('\tContainer Spec');
  if (!containerSpec) {
    console.log(`\t\t${JSON.stringify(containerSpec)}`);
    console.log('\t\tImage uri : {}');
    console.log('\t\tCommand : {}');
    console.log('\t\tArgs : {}');
    console.log('\t\tPredict route : {}');
    console.log('\t\tHealth route : {}');
    console.log('\t\tEnv');
    console.log('\t\t\t{}');
    console.log('\t\tPort');
    console.log('\t\t{}');
  } else {
    console.log(`\t\t${JSON.stringify(containerSpec)}`);
    console.log(`\t\tImage uri : ${containerSpec.imageUri}`);
    console.log(`\t\tCommand : ${containerSpec.command}`);
    console.log(`\t\tArgs : ${containerSpec.args}`);
    console.log(`\t\tPredict route : ${containerSpec.predictRoute}`);
    console.log(`\t\tHealth route : ${containerSpec.healthRoute}`);
    const env = containerSpec.env;
    console.log('\t\tEnv');
    console.log(`\t\t\t${JSON.stringify(env)}`);
    const ports = containerSpec.ports;
    console.log('\t\tPort');
    console.log(`\t\t\t${JSON.stringify(ports)}`);
  }

  const [deployedModels] = response.deployedModels;
  console.log('\tDeployed models');
  console.log('\t\t', deployedModels);
}
getModel();

Python

Informationen zur Installation des Vertex AI SDK for Python finden Sie unter Vertex AI SDK for Python installieren. Weitere Informationen finden Sie in der Referenzdokumentation zur Python API.

def get_model_sample(project: str, location: str, model_name: str):

    aiplatform.init(project=project, location=location)

    model = aiplatform.Model(model_name=model_name)

    print(model.display_name)
    print(model.resource_name)
    return model

Nächste Schritte