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.

build(texture): cache the fp16 ControlNet the runtime actually loads and ship the projection module

nirholasd2fc922f3595
diff --git a/workers/texture/Dockerfile b/workers/texture/Dockerfile
index 744b0d0b8..c14f93033 100644
--- a/workers/texture/Dockerfile
+++ b/workers/texture/Dockerfile
@@ -27,17 +27,24 @@ RUN pip install -r /app/requirements.txt
# a cache written to /weights would be invisible at runtime. /opt/hf-cache is
# always reachable and is the loader's last-resort fallback when GCS staging
# (WEIGHTS_GCS_URI) is unset or the staging prefix is empty.
-ARG SDXL_MODEL=stabilityai/stable-diffusion-xl-base-1.0
+#
+# The fp16 variant, matching WEIGHT_VARIANT in main.py. Caching the
+# full-precision files instead would put 4.7 GiB in the image that the runtime
+# then ignores while it downloads the 2.3 GiB it actually asked for.
ARG CONTROLNET_MODEL=diffusers/controlnet-depth-sdxl-1.0
+ARG WEIGHT_VARIANT=fp16
RUN python3 -c " \
-from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline; \
+from diffusers import ControlNetModel; \
import torch; \
-ControlNetModel.from_pretrained('${CONTROLNET_MODEL}', torch_dtype=torch.float16, cache_dir='/opt/hf-cache'); \
+ControlNetModel.from_pretrained('${CONTROLNET_MODEL}', torch_dtype=torch.float16, use_safetensors=True, variant='${WEIGHT_VARIANT}', cache_dir='/opt/hf-cache'); \
print('ControlNet cached') \
"
WORKDIR /app
COPY worker_security.py /app/worker_security.py
+COPY texture_projection.py /app/texture_projection.py
+COPY test_texture_projection.py /app/test_texture_projection.py
+COPY stage_weights.py /app/stage_weights.py
COPY main.py /app/main.py
EXPOSE 8080
diff --git a/workers/texture/cloudbuild.yaml b/workers/texture/cloudbuild.yaml
index 8ce7a78ca..b5e5374cb 100644
--- a/workers/texture/cloudbuild.yaml
+++ b/workers/texture/cloudbuild.yaml
@@ -29,7 +29,9 @@ steps:
- ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest
- --cache-from
- ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest
- - --build-arg=SDXL_MODEL=stabilityai/stable-diffusion-xl-base-1.0
+ # Only the ControlNet is baked into the image (see the Dockerfile). The
+ # SDXL base and inpaint checkpoints come from the staged weights prefix
+ # below, so passing them here would be a build arg nothing reads.
- --build-arg=CONTROLNET_MODEL=diffusers/controlnet-depth-sdxl-1.0
- .