Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Ein Modellalias ist ein änderbarer, benannter Verweis auf eine Modellversion, die innerhalb einer Modellressource eindeutig ist. Ein Alias ist "veränderlich", da Aliasse von einer Modellversion in eine andere verschoben und "benannt" werden können, da es sich um benutzerdefinierte Strings handelt. Modellaliasse sind hilfreich, um eine bestimmte Modellversion durch Verweis abzurufen oder bereitzustellen, ohne die ID der jeweiligen Version zu kennen. Auf diese Weise funktionieren sie ähnlich wie Docker-Tags oder Zweigreferenzen in Git.
Wenn Sie ein neues Modell in Model Registry erstellen, wird der ersten Version automatisch der Alias default zugewiesen. Der Standardalias verweist auf die Modellversion, die verwendet wird, wenn ein Nutzer einen Befehl für ein Modell ausführt, ohne eine bestimmte Version anzugeben. Für die Übertragung des Standardalias ist immer eine Version eines Modells erforderlich. Ansonsten verhält sich der Standardalias wie jeder andere benutzerdefinierte Alias.
In der Google Cloud Console kann die Alias-Markierung den Beteiligten auf einen Blick helfen, welches Modell die stabile Version ist, die bereit für die Bereitstellung ist. Neben dem Standard-Alias können Sie Ihre eigenen benutzerdefinierten Aliasse erstellen und Modellen in Model Registry zuweisen.
In Model Registry sehen Sie in der Alias-Spalte auf einen Blick, welche Modellversion den Standardalias hat.
Wenn Sie den Alias einer anderen Modellversion zuweisen möchten, können Sie Aliasse einfach in eine andere Version verschieben.
Beachten Sie bei der Verwendung von Aliassen Folgendes:
Die Versionsaliasse sollten einmalig sein. Ein Alias kann jeweils immer nur einer Version für ein Modell zugewiesen sein.
Versionsaliasse dürfen nicht numerisch sein.
Wenn Sie keine Modellversion für die Produktion angeben, wird das Standardmodell verwendet.
Wählen Sie in Model Registry den Namen des Modells aus, das Sie bearbeiten möchten. Das Fenster mit den Modelldetails wird geöffnet. Alle Modellversionen werden aufgelistet. Eine der Modellversionen hat den Alias Standard.
Klicken Sie auf die Schaltfläche Aktionen für die Modellversion, die Sie die Standardversion zuweisen möchten.
Klicken Sie auf Als Standard festlegen.
Alias einer Modellversion hinzufügen
Rufen Sie in der Google Cloud Console die Seite Vertex AI Model Registry auf.
Wählen Sie in Model Registry den Namen des Modells aus, das Sie bearbeiten möchten. Das Fenster mit den Modelldetails wird geöffnet.
Wählen Sie auf der Detailseite die gewünschte Modellversion aus und klicken Sie auf Mehr.
Klicken Sie auf Alias bearbeiten.
Wählen Sie Neu hinzufügen aus.
Alias bearbeiten: Klicken Sie auf Alias hinzufügen und geben Sie den Namen des Alias ein, den Sie der Modellversion hinzufügen möchten.
Klicken Sie auf Speichern.
Modellversion mit neuem Alias hochladen
API
Python
fromtypingimportListfromgoogle.cloudimportaiplatformdefupload_new_aliased_model_version_sample(parent_name:str,artifact_uri:str,serving_container_image:str,is_default_version:bool,version_aliases:List[str],version_description:str,project:str,location:str,):
"""
UploadsanewaliasedversionofamodelwithID 'model_id'.Args:parent_name:Theparentresourcenameofanexistingmodel.artifact_uri:TheURIofthemodelartifacttoupload.serving_container_image:Thenameoftheservingcontainerimagetouse.is_default_version:Whetherthisversionisthedefaultversionofthemodel.version_aliases:Thealiasesofthemodelversion.version_description:Thedescriptionofthemodelversion.project:TheprojectID.location:Theregionname.Returns:Thenewversionofthemodel.
"""
# Initialize the client.aiplatform.init(project=project,location=location)# Upload a new aliased version of the Model resource with the ID 'model_id'. The parent_name of Model resource can be also# 'projects/<your-project-id>/locations/<your-region>/models/<your-model-id>'
model=aiplatform.Model.upload(artifact_uri=artifact_uri,serving_container_image=serving_container_image,parent_name=parent_name,is_default_version=is_default_version,version_aliases=version_aliases,version_description=version_description,)returnmodel
Modellalias löschen
Wenn Sie eine Modellversion löschen, die dem Standardalias zugewiesen ist, wird der Alias automatisch der nächsten Version zugewiesen.
Console
Rufen Sie in der Google Cloud Console die Seite Vertex AI Model Registry auf.
Wählen Sie in Model Registry den Namen des Modells aus, das Sie bearbeiten möchten. Das Fenster mit den Modelldetails wird geöffnet.
Klicken Sie auf der Detailseite auf die Schaltfläche Aktionen bei der Modellversion.
Klicken Sie auf Alias bearbeiten.
Eine Liste der mit der Modellversion verknüpften Aliasse wird angezeigt. Bewegen Sie den Mauszeiger rechts neben das Alias-Textfeld für das Label, damit das Papierkorbsymbol angezeigt wird.
Klicken Sie für den Alias, die Sie löschen möchten, auf das Papierkorbsymbol.
Klicken Sie auf Speichern.
API
Python
fromtypingimportListfromgoogle.cloudimportaiplatformdefdelete_aliases_model_version_sample(model_id:str,version_aliases:List[str],version_id:str,project:str,location:str,):
"""
Deletealiasestoamodelversion.Args:model_id:TheIDofthemodel.version_aliases:Theversionaliasestoassign.version_id:TheversionIDofthemodeltoassignthealiasesto.project:TheprojectID.location:Theregionname.ReturnsNone.
"""
# Initialize the client.aiplatform.init(project=project,location=location)# Initialize the Model Registry resource with the ID 'model_id'.The parent_name of Model resource can be also# 'projects/<your-project-id>/locations/<your-region>/models/<your-model-id>'
model_registry=aiplatform.models.ModelRegistry(model=model_id)# Remove the version aliases to the model version with the version 'version'.model_registry.remove_version_aliases(target_aliases=version_aliases,version=version_id)
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2024-11-29 (UTC)."],[],[],null,["# How to use model version aliases\n\nA model alias is a mutable, named reference to a model version unique within\na model resource. An alias is \"mutable\" because aliases can be moved from one model version\nto another and \"named\" because they are user-defined, arbitrary strings. Model\naliases are helpful for fetching or deploying a particular model version by\nreference without needing to know the specific version's ID. In this way,\nthey operate similarly to Docker Tags or Branch references in Git.\n\nWhen you create a new model in Model Registry, the first version\nautomatically gets assigned the *default* alias. The default alias references\nthe model version that is used if a user runs a command on a model without\nspecifying a particular version. One version of a model is required to carry the default\nalias at all times. Otherwise, the default alias behaves as any other user-defined alias.\n\nFrom the Google Cloud console the alias marker can help stakeholders understand at a glance\nwhich model is the stable version ready for deployment. In addition to the\ndefault alias, you can create and assign your own custom aliases to models\nin the Model Registry.\n\nIn Model Registry, you can see at a glance which model\nversion has the default alias by looking at the alias column.\n\nIf you decide you want to reassign the alias to a different model version,\nyou can move aliases to a different version.\n| **Note:** The required format of the version alias is `[a-z][a-z0-9-]{0,126}[a-z0-9]` to distinguish from `version_id`. A default version alias will be created for the first version of the model, and there must be exactly one default version alias for a model.\n\nSome considerations for using aliases:\n\n- Your version aliases should be unique; and an alias can only be assigned to a single version, by model, at a time.\n- Version aliases must be non-numerical.\n- If you don't specify a model version for production, the default model is used.\n- An alias is different from a label. [Learn more about model labels here](/vertex-ai/docs/model-registry/model-labels).\n- If you apply an existing alias that is used in another model version, the alias is removed from that version.\n\nSet a model version as default\n------------------------------\n\n1. In the Google Cloud console, go to the Vertex AI **Model Registry**\n page.\n\n [Go to the Model Registry page](https://console.cloud.google.com/vertex-ai/models)\n2. From the Model Registry, select the name of the model\n you want to edit. The model details window opens. All of the model\n versions are listed. One of the model versions has the **default** alias.\n\n3. Select the **Actions** button for the model version you want to assign the default version.\n\n4. Click **Set as default**.\n\nAdd an alias to a model version\n-------------------------------\n\n1. In the Google Cloud console, go to the Vertex AI **Model Registry**\n page.\n\n [Go to the Model Registry page](https://console.cloud.google.com/vertex-ai/models)\n2. From the Model Registry, select the name of the model\n you want to edit. The model details window opens.\n\n3. From the details page, select the model version you want and click **More**.\n\n4. Click **Edit alias** .\n Select **Add New.**\n\n5. **Edit alias:** Click **Add alias** and enter the name of the alias you want\n to add to the model version.\n\n6. Click **Save.**\n\nUpload a new aliased model version\n----------------------------------\n\n### API\n\n### Python\n\n\n from typing import List\n\n from google.cloud import aiplatform\n\n\n def upload_new_aliased_model_version_sample(\n parent_name: str,\n artifact_uri: str,\n serving_container_image: str,\n is_default_version: bool,\n version_aliases: List[str],\n version_description: str,\n project: str,\n location: str,\n ):\n \"\"\"\n Uploads a new aliased version of a model with ID 'model_id'.\n Args:\n parent_name: The parent resource name of an existing model.\n artifact_uri: The URI of the model artifact to upload.\n serving_container_image: The name of the serving container image to use.\n is_default_version: Whether this version is the default version of the model.\n version_aliases: The aliases of the model version.\n version_description: The description of the model version.\n project: The project ID.\n location: The region name.\n Returns:\n The new version of the model.\n \"\"\"\n # Initialize the client.\n aiplatform.init(project=project, location=location)\n\n # Upload a new aliased version of the Model resource with the ID 'model_id'. The parent_name of Model resource can be also\n # 'projects/\u003cyour-project-id\u003e/locations/\u003cyour-region\u003e/models/\u003cyour-model-id\u003e'\n model = aiplatform.Model.upload(\n artifact_uri=artifact_uri,\n serving_container_image=serving_container_image,\n parent_name=parent_name,\n is_default_version=is_default_version,\n version_aliases=version_aliases,\n version_description=version_description,\n )\n\n return model\n\n| **Note:** If you don't see the Alias column, you might need to click the **Column display options** button to make sure the Alias column item is selected for display.\n\nDelete a model alias\n--------------------\n\nWhen you delete a model version assigned the default alias, the alias is automatically\nassigned to the next most recent version. \n\n### Console\n\n1. In the Google Cloud console, go to the Vertex AI **Model Registry**\n page.\n\n [Go to the Model Registry page](https://console.cloud.google.com/vertex-ai/models)\n2. From the Model Registry, select the name of the model\n you want to edit. The model details window opens.\n\n3. From the details page click the **Actions** button on the model version.\n\n4. Click **Edit alias**.\n\n5. A list of the aliases attached to the model version displays. Hover your cursor\n to the right of the Alias field for the label to display the delete icon.\n\n6. Click the delete icon for the alias you want to delete.\n\n7. Click **Save**.\n\n### API\n\n### Python\n\n\n from typing import List\n\n from google.cloud import aiplatform\n\n\n def delete_aliases_model_version_sample(\n model_id: str,\n version_aliases: List[str],\n version_id: str,\n project: str,\n location: str,\n ):\n \"\"\"\n Delete aliases to a model version.\n Args:\n model_id: The ID of the model.\n version_aliases: The version aliases to assign.\n version_id: The version ID of the model to assign the aliases to.\n project: The project ID.\n location: The region name.\n Returns\n None.\n \"\"\"\n # Initialize the client.\n aiplatform.init(project=project, location=location)\n\n # Initialize the Model Registry resource with the ID 'model_id'.The parent_name of Model resource can be also\n # 'projects/\u003cyour-project-id\u003e/locations/\u003cyour-region\u003e/models/\u003cyour-model-id\u003e'\n model_registry = aiplatform.models.ModelRegistry(model=model_id)\n\n # Remove the version aliases to the model version with the version 'version'.\n model_registry.remove_version_aliases(\n target_aliases=version_aliases, version=version_id\n )"]]