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()
모델 버전 삭제
콘솔
Google Cloud 콘솔의 Vertex AI 섹션에서 Model Registry 페이지로 이동합니다.
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)
기본 별칭이 있는 모델 버전 삭제
콘솔
Model Registry에서 모델 이름을 선택하여 모델 버전을 봅니다.
원하는 버전을 선택하고 작업 버튼 more_vert에서 삭제를 클릭합니다.
기본 별칭 버전을 삭제하려고 시도하기 때문에 경고가 표시됩니다. 먼저 다른 버전을 기본 버전으로 설정하세요.
드롭다운에서 모델의 기본값으로 사용할 버전을 선택합니다.
확인 화면에서 설정 및 삭제를 클릭합니다.
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)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-16(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 )"]]