Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

3.8 KB
Raw Blame
substitutions:
  _REGION: us-central1
  _RUN_SA: avatar-reconstruction-sa@aerial-vehicle-466722-p5.iam.gserviceaccount.com
  _SERVICE: model-hunyuan3d
  _REPO: model-hunyuan3d
  _GCS_BUCKET: three-ws-avatar-reconstructions
  _WEIGHTS_BUCKET: three-ws-model-weights
  # min=0 since 2026-08-11, which is what this service has actually been
  # running. It used to pin one warm instance, because a cold FUSE-mounted
  # weight load (this tree spans ~25 GiB across three sub-models, far larger
  # than TRELLIS's 3 GiB) can stall 15+ minutes instead of loading in seconds.
  # That reasoning predates the RTX PRO 6000 lane: model-hunyuan3d-21-rtx is the
  # production Hunyuan3D service now and is the one kept warm, this 2.0 service
  # is only the fallback, and the region's L4 allocation is scarce enough that
  # pinning an idle fallback to one starves a lane that is actually serving. A
  # redeploy from this config must not silently re-claim it.
  # max=1: the region's Cloud Run L4 allocation is shared with model-trellis
  # (min 1) and model-rig (min 1); MAX_CONCURRENT is 1 anyway, so a second
  # instance would only contend for a GPU another lane needs.
  _MIN_INSTANCES: "0"
  _MAX_INSTANCES: "1"

steps:
  # --cache-from only consults images already present on the builder — without
  # this pull every rebuild recompiles the CUDA extensions (~35 min) from
  # scratch and blows the build timeout. Best-effort: a missing :latest (first
  # build) just skips the cache.
  - id: pull-cache
    name: gcr.io/cloud-builders/docker
    entrypoint: bash
    args: ['-c', 'docker pull ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest || exit 0']

  - id: build
    name: gcr.io/cloud-builders/docker
    dir: workers/model-hunyuan3d
    args:
      - build
      - --tag
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA
      - --tag
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest
      - --cache-from
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest
      - .

  - id: push
    name: gcr.io/cloud-builders/docker
    args:
      - push
      - --all-tags
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server

  - id: deploy
    name: gcr.io/google.com/cloudsdktool/cloud-sdk:slim
    entrypoint: gcloud
    args:
      - run
      - deploy
      - ${_SERVICE}
      - --image=${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA
      - --region=${_REGION}
      - --service-account=${_RUN_SA}
      - --platform=managed
      - --port=8080
      - --gpu=1
      - --gpu-type=nvidia-l4
      - --no-gpu-zonal-redundancy
      - --no-cpu-throttling
      - --cpu=8
      - --memory=32Gi
      - --min-instances=${_MIN_INSTANCES}
      - --max-instances=${_MAX_INSTANCES}
      - --timeout=900
      - --allow-unauthenticated
      - --add-volume=name=weights,type=cloud-storage,bucket=${_WEIGHTS_BUCKET}
      - --add-volume-mount=volume=weights,mount-path=/weights
      - --set-env-vars=GCS_BUCKET=${_GCS_BUCKET},WEIGHTS_DIR=/weights/hunyuan3d-2,MAX_CONCURRENT=1,WEIGHTS_GCS_URI=gs://${_WEIGHTS_BUCKET}/hunyuan3d-2,WEIGHTS_LOCAL_DIR=/tmp/hunyuan3d-2
      - --set-secrets=API_KEY=avatar-reconstruction-key:latest

images:
  - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA
  - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest

options:
  machineType: E2_HIGHCPU_32
  logging: CLOUD_LOGGING_ONLY

# The project's default compute service account was deleted (see
# docs/ops/gcp-production.md) — every Cloud Build must pin the build SA
# explicitly or the submit fails with "Unknown service account".
serviceAccount: projects/aerial-vehicle-466722-p5/serviceAccounts/[email protected]

# CUDA custom-rasterizer + mesh-processor compiles push past the 10-minute default.
timeout: 3600s