Julien Blanchon
commited on
Commit
·
9f5e222
1
Parent(s):
9d70bb5
Final optimization: use pre-built wheel with correct GPU architectures
Browse files- Built gsplat wheel locally with TORCH_CUDA_ARCH_LIST='7.5;8.0;8.6' for HF Spaces
- Uploaded optimized wheel to blanchon/image-gs-models-utils repository
- Simplified Dockerfile to download wheel (no compilation in Docker)
- Use direct .venv/bin/python execution for fastest startup
- This avoids both memory issues and CUDA kernel compatibility problems
- Dockerfile +8 -17
- pyproject.docker.toml +1 -1
Dockerfile
CHANGED
|
@@ -42,27 +42,18 @@ ENV HOME=/home/user \
|
|
| 42 |
GRADIO_SERVER_PORT=7860 \
|
| 43 |
UV_CACHE_DIR=/home/user/.cache/uv
|
| 44 |
|
| 45 |
-
# Copy dependency files
|
| 46 |
COPY --chown=user pyproject.docker.toml ./pyproject.toml
|
| 47 |
-
COPY --chown=user gsplat/ ./gsplat/
|
| 48 |
|
| 49 |
-
#
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
|
| 54 |
-
#
|
| 55 |
RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
|
| 56 |
UV_CACHE_DIR=/tmp/uv-cache uv sync --no-dev
|
| 57 |
|
| 58 |
-
# Build gsplat wheel for target architecture and reinstall it (single-threaded to avoid OOM)
|
| 59 |
-
RUN cd gsplat && \
|
| 60 |
-
MAX_JOBS=1 uv run python setup.py bdist_wheel && \
|
| 61 |
-
mkdir -p ../wheels && \
|
| 62 |
-
cp dist/*.whl ../wheels/ && \
|
| 63 |
-
cd .. && \
|
| 64 |
-
uv pip install wheels/gsplat-0.1.0-cp310-cp310-linux_x86_64.whl --force-reinstall
|
| 65 |
-
|
| 66 |
# Copy the rest of the application
|
| 67 |
COPY --chown=user . .
|
| 68 |
|
|
@@ -72,5 +63,5 @@ COPY --chown=user pyproject.docker.toml ./pyproject.toml
|
|
| 72 |
# Expose port 7860 (default for HF Spaces)
|
| 73 |
EXPOSE 7860
|
| 74 |
|
| 75 |
-
# Launch the Gradio app
|
| 76 |
-
CMD ["
|
|
|
|
| 42 |
GRADIO_SERVER_PORT=7860 \
|
| 43 |
UV_CACHE_DIR=/home/user/.cache/uv
|
| 44 |
|
| 45 |
+
# Copy dependency files
|
| 46 |
COPY --chown=user pyproject.docker.toml ./pyproject.toml
|
|
|
|
| 47 |
|
| 48 |
+
# Download optimized gsplat wheel (built with HF Spaces GPU architectures)
|
| 49 |
+
RUN mkdir -p wheels && \
|
| 50 |
+
wget -O wheels/gsplat-0.1.0-cp310-cp310-linux_x86_64.whl \
|
| 51 |
+
"https://huggingface.co/blanchon/image-gs-models-utils/resolve/main/gsplat-0.1.0-cp310-cp310-linux_x86_64.whl"
|
| 52 |
|
| 53 |
+
# Install dependencies with optimized wheel
|
| 54 |
RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
|
| 55 |
UV_CACHE_DIR=/tmp/uv-cache uv sync --no-dev
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
# Copy the rest of the application
|
| 58 |
COPY --chown=user . .
|
| 59 |
|
|
|
|
| 63 |
# Expose port 7860 (default for HF Spaces)
|
| 64 |
EXPOSE 7860
|
| 65 |
|
| 66 |
+
# Launch the Gradio app directly with venv python (no uv overhead)
|
| 67 |
+
CMD [".venv/bin/python", "gradio_app.py"]
|
pyproject.docker.toml
CHANGED
|
@@ -24,7 +24,7 @@ dependencies = [
|
|
| 24 |
# We use python 3.10 and cu124
|
| 25 |
[tool.uv.sources]
|
| 26 |
fused_ssim = { git = "https://github.com/rahul-goel/fused-ssim/" }
|
| 27 |
-
gsplat = { path = "gsplat" }
|
| 28 |
torch = [
|
| 29 |
{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
|
| 30 |
]
|
|
|
|
| 24 |
# We use python 3.10 and cu124
|
| 25 |
[tool.uv.sources]
|
| 26 |
fused_ssim = { git = "https://github.com/rahul-goel/fused-ssim/" }
|
| 27 |
+
gsplat = { path = "wheels/gsplat-0.1.0-cp310-cp310-linux_x86_64.whl" }
|
| 28 |
torch = [
|
| 29 |
{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
|
| 30 |
]
|