step 4: endpoint-ready server (Dockerfile)
Browse files- Dockerfile +21 -9
Dockerfile
CHANGED
|
@@ -1,12 +1,18 @@
|
|
| 1 |
# MolmoAct2-SO100_101 cloud-inference server as a HuggingFace **Docker** Space.
|
| 2 |
#
|
| 3 |
-
# WHY A DOCKER SPACE (not
|
| 4 |
-
#
|
| 5 |
-
# `transformers.
|
| 6 |
-
#
|
| 7 |
-
#
|
| 8 |
-
#
|
| 9 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
#
|
| 11 |
# Base image = the SAME torch stack proven on HF Jobs (torch 2.5.1 + cu121):
|
| 12 |
# pinning transformers on top of it does NOT upgrade torch, so torchvision /
|
|
@@ -39,6 +45,12 @@ COPY --chown=user:user rtc.py .
|
|
| 39 |
RUN mkdir -p /home/user/.cache/huggingface && chown -R user:user /home/user /app
|
| 40 |
USER user
|
| 41 |
|
| 42 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
EXPOSE 7860
|
| 44 |
-
CMD ["
|
|
|
|
| 1 |
# MolmoAct2-SO100_101 cloud-inference server as a HuggingFace **Docker** Space.
|
| 2 |
#
|
| 3 |
+
# WHY A DOCKER SPACE (not a managed Inference Endpoint): the managed container
|
| 4 |
+
# bakes in `huggingface_inference_toolkit`, which HARD-PINS transformers==4.51.3.
|
| 5 |
+
# That predates `transformers.video_utils.VideoInput` (added in 4.57.0), which
|
| 6 |
+
# MolmoAct2's trust_remote_code processor imports — so the managed image simply
|
| 7 |
+
# cannot satisfy the model. A Docker Space runs OUR uvicorn directly: no toolkit,
|
| 8 |
+
# and we own the exact transformers version.
|
| 9 |
+
#
|
| 10 |
+
# CORRECTION (2026-07-21): this comment previously blamed the toolkit importing
|
| 11 |
+
# `transformers.file_utils.is_tf_available`, said to be "REMOVED in >=4.57". That
|
| 12 |
+
# is false — is_tf_available is present through 4.57.3 and only disappears in
|
| 13 |
+
# v5.0.0. The version floor below is right; only the reason was wrong. Note the
|
| 14 |
+
# managed path may still be reachable with a CUSTOM container image, which
|
| 15 |
+
# bypasses the toolkit entirely — untested here.
|
| 16 |
#
|
| 17 |
# Base image = the SAME torch stack proven on HF Jobs (torch 2.5.1 + cu121):
|
| 18 |
# pinning transformers on top of it does NOT upgrade torch, so torchvision /
|
|
|
|
| 45 |
RUN mkdir -p /home/user/.cache/huggingface && chown -R user:user /home/user /app
|
| 46 |
USER user
|
| 47 |
|
| 48 |
+
# PORT: Spaces route to 7860 (declared as app_port in README.md). Inference
|
| 49 |
+
# Endpoints take the container port from the endpoint config — set the endpoint's
|
| 50 |
+
# port to 7860 too, or override with a PORT env var here. A port mismatch is the
|
| 51 |
+
# documented #1 cause of an endpoint stuck "initializing", hence the explicit
|
| 52 |
+
# declaration + env override. (Also set the endpoint's health_route=/ready — it
|
| 53 |
+
# 503s until the model is loaded; "/" and /health stay 200-while-loading for the
|
| 54 |
+
# Space's readiness probe.)
|
| 55 |
EXPOSE 7860
|
| 56 |
+
CMD ["sh", "-c", "uvicorn molmoact2_server:app --host 0.0.0.0 --port ${PORT:-7860}"]
|