Julien Blanchon commited on
Commit ·
c34e5f6
1
Parent(s): 6f11a19
Build gsplat wheel directly in Docker for GPU architecture compatibility
Browse files- Build gsplat wheel in Docker with target GPU architectures (6.0-9.0)
- Install PyTorch first, then compile gsplat for the specific environment
- Set TORCH_CUDA_ARCH_LIST for broad GPU compatibility in HF Spaces
- This fixes 'no kernel image is available for execution on the device' error
- Ensures CUDA kernels match the actual GPU hardware available
- Dockerfile +20 -7
- pyproject.docker.toml +1 -1
Dockerfile
CHANGED
|
@@ -45,15 +45,28 @@ ENV HOME=/home/user \
|
|
| 45 |
# Copy Docker-specific dependency files
|
| 46 |
COPY --chown=user pyproject.docker.toml ./pyproject.toml
|
| 47 |
|
| 48 |
-
#
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
"https://huggingface.co/blanchon/image-gs-models-utils/resolve/main/gsplat-0.1.0-cp310-cp310-linux_x86_64.whl"
|
| 52 |
|
| 53 |
-
# Create virtual environment
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
uv venv .venv
|
| 57 |
|
| 58 |
# Copy the rest of the application
|
| 59 |
COPY --chown=user . .
|
|
|
|
| 45 |
# Copy Docker-specific dependency files
|
| 46 |
COPY --chown=user pyproject.docker.toml ./pyproject.toml
|
| 47 |
|
| 48 |
+
# Set CUDA compilation flags for HF Spaces GPU compatibility
|
| 49 |
+
ENV TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0" \
|
| 50 |
+
FORCE_CUDA=1
|
|
|
|
| 51 |
|
| 52 |
+
# Create virtual environment first
|
| 53 |
+
RUN uv venv .venv
|
| 54 |
+
|
| 55 |
+
# Install PyTorch and basic dependencies first (needed for gsplat compilation)
|
| 56 |
+
RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
|
| 57 |
+
UV_CACHE_DIR=/tmp/uv-cache .venv/bin/pip install torch torchvision numpy
|
| 58 |
+
|
| 59 |
+
# Copy gsplat source and build wheel for target architecture
|
| 60 |
+
COPY --chown=user gsplat/ ./gsplat/
|
| 61 |
+
RUN cd gsplat && \
|
| 62 |
+
../.venv/bin/python setup.py bdist_wheel && \
|
| 63 |
+
mkdir -p ../wheels && \
|
| 64 |
+
cp dist/*.whl ../wheels/ && \
|
| 65 |
+
cd ..
|
| 66 |
+
|
| 67 |
+
# Install all remaining dependencies with the fresh-built wheel
|
| 68 |
RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
|
| 69 |
+
UV_CACHE_DIR=/tmp/uv-cache uv sync --no-dev
|
|
|
|
| 70 |
|
| 71 |
# Copy the rest of the application
|
| 72 |
COPY --chown=user . .
|
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 = "
|
| 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 = "gsplat" }
|
| 28 |
torch = [
|
| 29 |
{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
|
| 30 |
]
|