Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Pelajari cara menghapus model yang tidak lagi Anda perlukan dari Vertex AI Model Registry.
Jika ingin menghapus BigQuery ML dari Vertex AI Model Registry,
Anda harus menghapusnya terlebih dahulu dari BigQuery ML. Untuk mempelajari lebih lanjut,
lihat BigQuery ML dan Vertex AI Model Registry.
Jika ingin menghapus model yang di-deploy ke endpoint, Anda
harus membatalkan deployment model tersebut terlebih dahulu. Jika tidak, Anda tidak dapat menghapus model.
Menghapus model
Konsol
Buka halaman Model Registry dari bagian Vertex AI
di konsol Google Cloud .
Menghapus model menggunakan Vertex AI SDK untuk Python.
Python
fromgoogle.cloudimportaiplatformdefdelete_model_sample(model_id:str,project:str,location:str):""" Delete a Model resource. Args: model_id: The ID of the model to delete. Parent resource name of the model is also accepted. project: The project. location: The region name. Returns None. """# Initialize the client.aiplatform.init(project=project,location=location)# Get the model 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(model_name=model_id)# Delete the model.model.delete()
Menghapus versi model
Konsol
Buka halaman Model Registry dari bagian Vertex AI
di konsol Google Cloud .
fromgoogle.cloudimportaiplatformdefdelete_model_version_sample(model_id:str,version_id:str,project:str,location:str):""" Delete a Model version. Args: model_id: The ID of the model to delete. Parent resource name of the model is also accepted. version_id: The version ID or version alias of the model to delete. project: The project ID. location: The region name. Returns None. """# 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)# Delete the model version with the version 'version'.model_registry.delete_version(version=version_id)
Menghapus versi model dengan alias default
Konsol
Dari Model Registry, pilih nama model untuk melihat
versi modelnya.
Pilih versi yang Anda inginkan, dan dari tombol
Tindakanmore_vert, klik Hapus.
Peringatan akan muncul karena Anda mencoba menghapus
versi alias default. Setel versi lain sebagai default terlebih dahulu.
Pilih versi yang ingin dijadikan default untuk
model dari menu drop-down.
Di layar konfirmasi, klik Setel dan hapus.
API
Python
fromtypingimportListfromgoogle.cloudimportaiplatformdefdelete_aliases_model_version_sample(model_id:str,version_aliases:List[str],version_id:str,project:str,location:str,):""" Delete aliases to a model version. Args: model_id: The ID of the model. version_aliases: The version aliases to assign. version_id: The version ID of the model to assign the aliases to. project: The project ID. location: The region name. Returns None. """# 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)
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-19 UTC."],[],[],null,["# Delete a model from Vertex AI Model Registry\n\nLearn how to delete a model you no longer need from the Vertex AI Model Registry.\n\nIf you want to delete a BigQuery ML from Vertex AI Model Registry,\nyou must first delete it from BigQuery ML. To learn more,\nsee [BigQuery ML and Vertex AI Model Registry](/bigquery-ml/docs/managing-models-vertex).\n\nIf you want to delete a model that is deployed to an endpoint, you\nneed to undeploy it first. Otherwise, you are unable to delete the model.\n\nDelete a model\n--------------\n\n### Console\n\n1. Go to the **Model Registry** page from the Vertex AI section\n in the Google Cloud console.\n\n [Go to the Model Registry page](https://console.cloud.google.com/vertex-ai/models)\n2. Select **More actions** from the model you want to delete.\n more_vert\n\n3. Select **Delete model**.\n When you delete the model, all associated model versions and evaluations are\n deleted from your Google Cloud project.\n\n4. Click **Delete** on the confirmation screen.\n\n### gcloud\n\n\nBefore using any of the command data below,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003eMODEL_ID\u003c/var\u003e: The ID of your model.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#identifiers).\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: Your project's region. For example, `us-central1`.\n\n\nExecute the\n\nfollowing\n\ncommand:\n\n#### Linux, macOS, or Cloud Shell\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud ai models delete MODEL_ID \\\n --project=PROJECT_ID \\\n --region=LOCATION\n```\n\n#### Windows (PowerShell)\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud ai models delete MODEL_ID `\n --project=PROJECT_ID `\n --region=LOCATION\n```\n\n#### Windows (cmd.exe)\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud ai models delete MODEL_ID ^\n --project=PROJECT_ID ^\n --region=LOCATION\n```\n\n\u003cbr /\u003e\n\n### API\n\n\nDelete a model using the Vertex AI SDK for Python.\n\n### Python\n\n\n from google.cloud import aiplatform\n\n\n def delete_model_sample(model_id: str, project: str, location: str):\n \"\"\"\n Delete a Model resource.\n Args:\n model_id: The ID of the model to delete. Parent resource name of the model is also accepted.\n project: The project.\n location: The region name.\n Returns\n None.\n \"\"\"\n # Initialize the client.\n aiplatform.init(project=project, location=location)\n\n # Get the model 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(model_name=model_id)\n\n # Delete the model.\n model.delete()\n\nDelete a model version\n----------------------\n\n### Console\n\n1. Go to the **Model Registry** page from the Vertex AI section\n in the Google Cloud console.\n\n [Go to the Model Registry page](https://console.cloud.google.com/vertex-ai/models)\n2. Expand the model to view its model versions. Select the version that you want to delete.\n\n3. Select the **More actions** from the model version.\n menu more_vert.\n\n4. Select **Delete version**. All associated model evaluations are deleted when you delete your version.\n\n### gcloud\n\n\nBefore using any of the command data below,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003eMODEL_VERSION_ID\u003c/var\u003e: The ID of the model version to delete.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#identifiers).\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: Your project's region. For example, `us-central1`.\n\n\nExecute the\n\nfollowing\n\ncommand:\n\n#### Linux, macOS, or Cloud Shell\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud ai models delete-version MODEL_VERSION_ID \\\n --project=PROJECT_ID \\\n --region=LOCATION\n```\n\n#### Windows (PowerShell)\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud ai models delete-version MODEL_VERSION_ID `\n --project=PROJECT_ID `\n --region=LOCATION\n```\n\n#### Windows (cmd.exe)\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud ai models delete-version MODEL_VERSION_ID ^\n --project=PROJECT_ID ^\n --region=LOCATION\n```\n\n\u003cbr /\u003e\n\n### API\n\n### Python\n\n\n from google.cloud import aiplatform\n\n\n def delete_model_version_sample(\n model_id: str, version_id: str, project: str, location: str\n ):\n \"\"\"\n Delete a Model version.\n Args:\n model_id: The ID of the model to delete. Parent resource name of the model is also accepted.\n version_id: The version ID or version alias of the model to delete.\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 # Delete the model version with the version 'version'.\n model_registry.delete_version(version=version_id)\n\nDelete a model version with the default alias\n---------------------------------------------\n\n### Console\n\n1. From the Model Registry, select the model name to view its model versions.\n2. Select the version that you want, and from the **Actions** button more_vert click **Delete**. A warning opens since you're attempting to delete the default alias version. Set another version as default first.\n3. Select what version you want to make default for the model from the drop-down.\n4. On the confirmation screen, click **Set and delete.**\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 )"]]