커스텀 가중치를 적용한 모델 배포

커스텀 가중치로 모델을 배포하는 것은 프리뷰로 제공됩니다. 사전 정의된 기본 모델 세트를 기반으로 모델을 미세 조정하고 맞춤설정된 모델을 Vertex AI Model Garden에 배포할 수 있습니다. Vertex AI에서 클릭 한 번으로 모델 아티팩트를 프로젝트의 Cloud Storage 버킷에 업로드하여 커스텀 가중치 가져오기를 사용해 커스텀 모델을 배포할 수 있습니다.

지원되는 모델

커스텀 가중치로 모델 배포 공개 프리뷰는 다음 기본 모델에서 지원됩니다.

모델 이름 버전
Llama
  • Llama-2: 7B, 13B
  • Llama-3.1: 8B, 70B
  • Llama-3.2: 1B, 3B
  • Llama-4: Scout-17B, Maverick-17B
  • CodeLlama-13B
Gemma
  • Gemma-2: 27B
  • Gemma-3: 1B, 4B, 3-12B, 27B
  • Medgemma: 4B, 27B-text
Qwen
  • Qwen2: 1.5B
  • Qwen2.5: 0.5B, 1.5B, 7B, 32B
  • Qwen3: 0.6B, 1.7B, 8B, 32B, Qwen3-Coder-480B-A35B-Instruct
Deepseek
  • Deepseek-R1
  • Deepseek-V3
Mistral 및 Mixtral
  • Mistral-7B-v0.1
  • Mixtral-8x7B-v0.1
  • Mistral-Nemo-Base-2407
Phi-4
  • Phi-4-reasoning
OpenAI OSS
  • gpt-oss: 20B, 120B

제한사항

커스텀 가중치는 양자화된 모델의 가져오기를 지원하지 않습니다.

모델 파일

Hugging Face 가중치 형식으로 모델 파일을 제공해야 합니다. Hugging Face 가중치 형식에 관한 자세한 내용은 Hugging Face 모델 사용을 참조하세요.

필수 파일이 제공되지 않으면 모델 배포가 실패할 수 있습니다.

이 표에는 모델 아키텍처에 따라 달라지는 모델 파일 유형이 나와 있습니다.

모델 파일 콘텐츠 파일 형식
모델 구성
  • config.json
모델 가중치
  • *.safetensors
  • *.bin
가중치 색인
  • *.index.json
토크나이저 파일
  • tokenizer.model
  • tokenizer.json
  • tokenizer_config.json

위치

Model Garden 서비스에서 모든 리전에 커스텀 모델을 배포할 수 있습니다.

기본 요건

이 섹션에서는 커스텀 모델을 배포하는 방법을 보여줍니다.

시작하기 전에

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud 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 (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Vertex AI API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud 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 (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the Vertex AI API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  8. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  9. 이 튜토리얼에서는 Cloud Shell을 사용하여 Google Cloud와 상호작용한다고 가정합니다. Cloud Shell 대신 다른 셸을 사용하려면 다음 추가 구성을 수행하세요.

    1. Install the Google Cloud CLI.

    2. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

    3. To initialize the gcloud CLI, run the following command:

      gcloud init

    커스텀 모델 배포

    이 섹션에서는 커스텀 모델을 배포하는 방법을 보여줍니다.

    명령줄 인터페이스(CLI), Python 또는 JavaScript를 사용하는 경우 다음 변수를 코드 샘플이 작동하는 값으로 바꿉니다.

    • REGION: 사용자의 리전. 예를 들면 uscentral1입니다.
    • MODEL_GCS: Google Cloud 모델. 예를 들면 gs://custom-weights-fishfooding/meta-llama/Llama-3.2-1B-Instruct입니다.
    • PROJECT_ID: 프로젝트 ID.
    • MODEL_ID: 모델 ID
    • MACHINE_TYPE: 머신 유형. 예를 들면 g2-standard-12입니다.
    • ACCELERATOR_TYPE: 가속기 유형. 예를 들면 NVIDIA_L4입니다.
    • ACCELERATOR_COUNT: 가속기 수
    • PROMPT: 텍스트 프롬프트

    콘솔

    다음 단계에서는 Google Cloud 콘솔을 사용하여 커스텀 가중치로 모델을 배포하는 방법을 보여줍니다.

    1. Google Cloud 콘솔에서 Model Garden 페이지로 이동합니다.

      Model Garden으로 이동

    2. 커스텀 가중치로 모델 배포를 클릭합니다. Vertex AI에서 커스텀 가중치로 모델 배포 창이 표시됩니다.

    3. 모델 소스 섹션에서 다음을 수행합니다.

      1. 찾아보기를 클릭하고 모델이 저장된 버킷을 선택한 다음 선택을 클릭합니다.

      2. 선택사항: 모델 이름 필드에 모델 이름을 입력합니다.

    4. 대상 설정 섹션에서 다음을 수행합니다.

      1. 리전 필드에서 리전을 선택하고 확인을 클릭합니다.

      2. 머신 사양 필드에서 모델을 배포하는 데 사용되는 머신 사양을 선택합니다.

      3. 선택사항: 엔드포인트 이름 필드에 모델의 엔드포인트가 기본적으로 표시됩니다. 하지만 필드에 다른 엔드포인트 이름을 입력할 수 있습니다.

    5. 커스텀 가중치로 모델 배포를 클릭합니다.

    gcloud CLI

    이 명령어는 특정 리전에 모델을 배포하는 방법을 보여줍니다.

    gcloud ai model-garden models deploy --model=${MODEL_GCS} --region ${REGION}
    

    이 명령어는 머신 유형, 가속기 유형, 가속기 수를 사용하여 특정 리전에 모델을 배포하는 방법을 보여줍니다. 특정 머신 구성을 선택하려면 세 필드를 모두 설정해야 합니다.

    gcloud ai model-garden models deploy --model=${MODEL_GCS} --machine-type=${MACHINE_TYE} --accelerator-type=${ACCELERATOR_TYPE} --accelerator-count=${ACCELERATOR_COUNT} --region ${REGION}
    

    Python

    import vertexai
    from google.cloud import aiplatform
    from vertexai.preview import model_garden
    
    vertexai.init(project=${PROJECT_ID}, location=${REGION})
    custom_model = model_garden.CustomModel(
      gcs_uri=GCS_URI,
    )
    endpoint = custom_model.deploy(
      machine_type="${MACHINE_TYPE}",
      accelerator_type="${ACCELERATOR_TYPE}",
      accelerator_count="${ACCELERATOR_COUNT}",
      model_display_name="custom-model",
      endpoint_display_name="custom-model-endpoint")
    
    endpoint.predict(instances=[{"prompt": "${PROMPT}"}], use_dedicated_endpoint=True)
    

    또는 custom_model.deploy() 메서드에 파라미터를 전달하지 않아도 됩니다.

    import vertexai
    from google.cloud import aiplatform
    from vertexai.preview import model_garden
    
    vertexai.init(project=${PROJECT_ID}, location=${REGION})
    custom_model = model_garden.CustomModel(
      gcs_uri=GCS_URI,
    )
    endpoint = custom_model.deploy()
    
    endpoint.predict(instances=[{"prompt": "${PROMPT}"}], use_dedicated_endpoint=True)
    

    curl

    
    curl -X POST \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      -H "Content-Type: application/json" \
      "https://${REGION}-aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${REGION}:deploy" \
      -d '{
        "custom_model": {
        "gcs_uri": "'"${MODEL_GCS}"'"
      },
      "destination": "projects/'"${PROJECT_ID}"'/locations/'"${REGION}"'",
      "model_config": {
         "model_user_id": "'"${MODEL_ID}"'",
      },
    }'
    

    또는 API를 사용하여 머신 유형을 명시적으로 설정할 수 있습니다.

    
    curl -X POST \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      -H "Content-Type: application/json" \
      "https://${REGION}-aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${REGION}:deploy" \
      -d '{
        "custom_model": {
        "gcs_uri": "'"${MODEL_GCS}"'"
      },
      "destination": "projects/'"${PROJECT_ID}"'/locations/'"${REGION}"'",
      "model_config": {
         "model_user_id": "'"${MODEL_ID}"'",
      },
      "deploy_config": {
        "dedicated_resources": {
          "machine_spec": {
            "machine_type": "'"${MACHINE_TYPE}"'",
            "accelerator_type": "'"${ACCELERATOR_TYPE}"'",
            "accelerator_count": '"${ACCELERATOR_COUNT}"'
          },
          "min_replica_count": 1
        }
      }
    }'
    

    Vertex AI에서 자체 배포된 모델에 대해 자세히 알아보기