Julien Blanchon commited on
Commit
090544c
·
1 Parent(s): 604a6c7

Add debug logging and fix Docker venv setup

Browse files

- Add debug logging to identify which tensor has wrong type in CUDA call
- Fix Dockerfile to use proper venv instead of uv run (avoids package reinstalls)
- Use direct .venv/bin/python execution for faster startup
- This should prevent fused-ssim reinstallation on every launch

Files changed (2) hide show
  1. Dockerfile +5 -4
  2. gradio_models.py +7 -2
Dockerfile CHANGED
@@ -50,9 +50,10 @@ 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 uv (using pre-built wheel - much faster!)
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 . .
@@ -63,5 +64,5 @@ COPY --chown=user pyproject.docker.toml ./pyproject.toml
63
  # Expose port 7860 (default for HF Spaces)
64
  EXPOSE 7860
65
 
66
- # Launch the Gradio app
67
- CMD ["uv", "run", "python", "gradio_app.py"]
 
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
+ # Create virtual environment and install dependencies
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 . .
 
64
  # Expose port 7860 (default for HF Spaces)
65
  EXPOSE 7860
66
 
67
+ # Activate venv and launch the Gradio app directly
68
+ CMD [".venv/bin/python", "gradio_app.py"]
gradio_models.py CHANGED
@@ -392,12 +392,17 @@ class GradioGaussianSplatting2D(nn.Module):
392
  xy, scale, rot, int(img_h), int(img_w), tile_bounds
393
  )
394
  xy, radii, conics, num_tiles_hit = tmp
395
-
396
  # Ensure num_tiles_hit is int32 tensor (required by CUDA backend)
397
  num_tiles_hit = num_tiles_hit.to(dtype=torch.int32)
398
 
399
  if not self.disable_tiles:
400
  enable_topk_norm = not self.disable_topk_norm
 
 
 
 
 
401
  out_image = rasterize_gaussians_sum(
402
  xy,
403
  radii,
@@ -476,7 +481,7 @@ class GradioGaussianSplatting2D(nn.Module):
476
  xy, scale, rot, int(self.img_h), int(self.img_w), self.tile_bounds
477
  )
478
  xy, radii, conics, num_tiles_hit = tmp
479
-
480
  # Ensure num_tiles_hit is int32 tensor (required by CUDA backend)
481
  num_tiles_hit = num_tiles_hit.to(dtype=torch.int32)
482
 
 
392
  xy, scale, rot, int(img_h), int(img_w), tile_bounds
393
  )
394
  xy, radii, conics, num_tiles_hit = tmp
395
+
396
  # Ensure num_tiles_hit is int32 tensor (required by CUDA backend)
397
  num_tiles_hit = num_tiles_hit.to(dtype=torch.int32)
398
 
399
  if not self.disable_tiles:
400
  enable_topk_norm = not self.disable_topk_norm
401
+
402
+ # Debug: Print tensor types to identify the Float tensor
403
+ self.worklog.info(f"DEBUG - Tensor types: xy={xy.dtype}, radii={radii.dtype}, conics={conics.dtype}, num_tiles_hit={num_tiles_hit.dtype}, feat={feat.dtype}")
404
+ self.worklog.info(f"DEBUG - Params: img_h={img_h} ({type(img_h)}), img_w={img_w} ({type(img_w)}), block_h={self.block_h} ({type(self.block_h)}), block_w={self.block_w} ({type(self.block_w)})")
405
+
406
  out_image = rasterize_gaussians_sum(
407
  xy,
408
  radii,
 
481
  xy, scale, rot, int(self.img_h), int(self.img_w), self.tile_bounds
482
  )
483
  xy, radii, conics, num_tiles_hit = tmp
484
+
485
  # Ensure num_tiles_hit is int32 tensor (required by CUDA backend)
486
  num_tiles_hit = num_tiles_hit.to(dtype=torch.int32)
487