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.

fix(hunyuan3d): load rembg's u2net model from the staged weights mount so one broken GitHub download cannot wedge the worker

nirholas2a55e792ff62
diff --git a/workers/model-hunyuan3d/README.md b/workers/model-hunyuan3d/README.md
index 0aa11fbc5..03d70fc4c 100644
--- a/workers/model-hunyuan3d/README.md
+++ b/workers/model-hunyuan3d/README.md
@@ -189,6 +189,7 @@ octree and per-view diffusion resolution up for sharper geometry and PBR maps.
| `DINO_LOCAL_DIR` | no | `/tmp/dinov2-giant` | Local staging dir for DINOv2 |
| `DINO_DIR` | no | `/weights/dinov2-giant` | FUSE-mount fallback for DINOv2 |
| `MAX_CONCURRENT` | no | `1` | In-flight inferences; one L4 fits one |
+| `U2NET_HOME` | no | `~/.u2net` | Where rembg looks for `u2net.onnx`; the deploy configs point it at the staged copy on the FUSE mount (`/weights/u2net`) |
**Weight staging.** The 2.1 shape DiT is a single 6.9 GiB `.ckpt` and the paint
UNet a single 3.7 GiB `.bin`. Reading files that large over the Cloud Storage
@@ -217,6 +218,19 @@ gcloud storage rsync --recursive /tmp/dinov2-giant gs://three-ws-model-weights/d
The RealESRGAN super-res checkpoint is fetched into the image at build time
(`hy3dpaint/ckpt/RealESRGAN_x4plus.pth`).
+**rembg's `u2net.onnx` is staged too.** Left alone, rembg downloads the 176 MB
+matting model from GitHub on every cold boot, and one broken download is fatal:
+the pipeline load fails and the instance answers every job with `load_error`
+until it is replaced (production, 2026-09-18, after a restart). The deploy
+configs set `U2NET_HOME=/weights/u2net`, so rembg finds the staged copy and never
+touches the network. To (re)stage it:
+
+```bash
+curl -sSL -o /tmp/u2net.onnx https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnx
+md5sum /tmp/u2net.onnx # 60024c5c889badc19c04ad937298a77b, the hash rembg verifies
+gcloud storage cp /tmp/u2net.onnx gs://three-ws-model-weights/u2net/u2net.onnx
+```
+
## Deploy
Submit from the **repo root** (the build step declares
diff --git a/workers/model-hunyuan3d/cloudbuild.hunyuan21.yaml b/workers/model-hunyuan3d/cloudbuild.hunyuan21.yaml
index 1e7a3dc3f..de6f954a8 100644
--- a/workers/model-hunyuan3d/cloudbuild.hunyuan21.yaml
+++ b/workers/model-hunyuan3d/cloudbuild.hunyuan21.yaml
@@ -60,7 +60,7 @@ steps:
- --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};HUNYUAN3D_MODEL=2.1;WEIGHTS_DIR=/weights/hunyuan3d-2.1;WEIGHTS_GCS_URI=gs://${_WEIGHTS_BUCKET}/hunyuan3d-2.1;WEIGHTS_LOCAL_DIR=/tmp/hunyuan3d-2.1;DINO_DIR=/weights/dinov2-giant;DINO_GCS_URI=gs://${_WEIGHTS_BUCKET}/dinov2-giant;DINO_LOCAL_DIR=/tmp/dinov2-giant;MAX_CONCURRENT=1
+ - --set-env-vars=^;^GCS_BUCKET=${_GCS_BUCKET};HUNYUAN3D_MODEL=2.1;WEIGHTS_DIR=/weights/hunyuan3d-2.1;WEIGHTS_GCS_URI=gs://${_WEIGHTS_BUCKET}/hunyuan3d-2.1;WEIGHTS_LOCAL_DIR=/tmp/hunyuan3d-2.1;DINO_DIR=/weights/dinov2-giant;DINO_GCS_URI=gs://${_WEIGHTS_BUCKET}/dinov2-giant;DINO_LOCAL_DIR=/tmp/dinov2-giant;U2NET_HOME=/weights/u2net;MAX_CONCURRENT=1
- --set-secrets=API_KEY=avatar-reconstruction-key:latest
images:
diff --git a/workers/model-hunyuan3d/cloudbuild.hunyuan21rtx.yaml b/workers/model-hunyuan3d/cloudbuild.hunyuan21rtx.yaml
index 0d554195e..bd8a33517 100644
--- a/workers/model-hunyuan3d/cloudbuild.hunyuan21rtx.yaml
+++ b/workers/model-hunyuan3d/cloudbuild.hunyuan21rtx.yaml
@@ -79,7 +79,7 @@ steps:
- --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};HUNYUAN3D_MODEL=2.1;WEIGHTS_DIR=/weights/hunyuan3d-2.1;WEIGHTS_GCS_URI=gs://${_WEIGHTS_BUCKET}/hunyuan3d-2.1;WEIGHTS_LOCAL_DIR=/tmp/hunyuan3d-2.1;DINO_DIR=/weights/dinov2-giant;DINO_GCS_URI=gs://${_WEIGHTS_BUCKET}/dinov2-giant;DINO_LOCAL_DIR=/tmp/dinov2-giant;MAX_CONCURRENT=1
+ - --set-env-vars=^;^GCS_BUCKET=${_GCS_BUCKET};HUNYUAN3D_MODEL=2.1;WEIGHTS_DIR=/weights/hunyuan3d-2.1;WEIGHTS_GCS_URI=gs://${_WEIGHTS_BUCKET}/hunyuan3d-2.1;WEIGHTS_LOCAL_DIR=/tmp/hunyuan3d-2.1;DINO_DIR=/weights/dinov2-giant;DINO_GCS_URI=gs://${_WEIGHTS_BUCKET}/dinov2-giant;DINO_LOCAL_DIR=/tmp/dinov2-giant;U2NET_HOME=/weights/u2net;MAX_CONCURRENT=1
- --set-secrets=API_KEY=avatar-reconstruction-key:latest
images: