Julien Blanchon
commited on
Commit
·
e732b53
1
Parent(s):
69a0f2c
Update
Browse files- Dockerfile +14 -11
- gradio_app.py +1 -1
- gradio_models.py +10 -6
- pyproject.docker.toml +7 -14
- pyproject.toml +5 -11
- uv.lock +6 -3
Dockerfile
CHANGED
|
@@ -1,13 +1,16 @@
|
|
| 1 |
# Use NVIDIA CUDA image that matches PyTorch's CUDA 12.4 compilation
|
| 2 |
FROM nvidia/cuda:12.4.0-devel-ubuntu22.04
|
| 3 |
|
| 4 |
-
# Install Python 3.
|
| 5 |
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
| 6 |
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
| 7 |
apt-get update && apt-get install -y \
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
python3-pip \
|
| 12 |
git \
|
| 13 |
build-essential \
|
|
@@ -16,8 +19,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
| 16 |
wget
|
| 17 |
|
| 18 |
# Create symlinks for python
|
| 19 |
-
RUN ln -sf /usr/bin/python3.
|
| 20 |
-
ln -sf /usr/bin/python3.
|
| 21 |
|
| 22 |
# Set CUDA environment variables for runtime
|
| 23 |
ENV CUDA_HOME=/usr/local/cuda \
|
|
@@ -46,12 +49,12 @@ ENV HOME=/home/user \
|
|
| 46 |
COPY --chown=user pyproject.docker.toml ./pyproject.toml
|
| 47 |
COPY --chown=user uv.docker.lock ./uv.lock
|
| 48 |
|
| 49 |
-
# Download pre-built wheels (built with
|
| 50 |
RUN mkdir -p wheels && \
|
| 51 |
-
wget -O wheels/gsplat-0.1.0-
|
| 52 |
-
"https://huggingface.co/blanchon/image-gs-models-utils/resolve/main/gsplat-0.1.0-
|
| 53 |
-
wget -O wheels/fused_ssim-0.0.
|
| 54 |
-
"https://huggingface.co/blanchon/image-gs-models-utils/resolve/main/fused_ssim-0.0.
|
| 55 |
|
| 56 |
# Install dependencies with exact versions from lock file
|
| 57 |
RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
|
|
|
|
| 1 |
# Use NVIDIA CUDA image that matches PyTorch's CUDA 12.4 compilation
|
| 2 |
FROM nvidia/cuda:12.4.0-devel-ubuntu22.04
|
| 3 |
|
| 4 |
+
# Install Python 3.13 and dependencies with cache mounts
|
| 5 |
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
| 6 |
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
| 7 |
apt-get update && apt-get install -y \
|
| 8 |
+
software-properties-common && \
|
| 9 |
+
add-apt-repository ppa:deadsnakes/ppa && \
|
| 10 |
+
apt-get update && apt-get install -y \
|
| 11 |
+
python3.13 \
|
| 12 |
+
python3.13-venv \
|
| 13 |
+
python3.13-dev \
|
| 14 |
python3-pip \
|
| 15 |
git \
|
| 16 |
build-essential \
|
|
|
|
| 19 |
wget
|
| 20 |
|
| 21 |
# Create symlinks for python
|
| 22 |
+
RUN ln -sf /usr/bin/python3.13 /usr/bin/python3 && \
|
| 23 |
+
ln -sf /usr/bin/python3.13 /usr/bin/python
|
| 24 |
|
| 25 |
# Set CUDA environment variables for runtime
|
| 26 |
ENV CUDA_HOME=/usr/local/cuda \
|
|
|
|
| 49 |
COPY --chown=user pyproject.docker.toml ./pyproject.toml
|
| 50 |
COPY --chown=user uv.docker.lock ./uv.lock
|
| 51 |
|
| 52 |
+
# Download pre-built wheels (built with PyTorch 2.6.0 + CUDA 12.4)
|
| 53 |
RUN mkdir -p wheels && \
|
| 54 |
+
wget -O wheels/gsplat-0.1.0-cp313-cp313-linux_x86_64.whl \
|
| 55 |
+
"https://huggingface.co/blanchon/image-gs-models-utils/resolve/main/gsplat-0.1.0-cp313-cp313-linux_x86_64.whl" && \
|
| 56 |
+
wget -O wheels/fused_ssim-0.0.1+b4fd832pt2.6.0cu124-cp313-cp313-linux_x86_64.whl \
|
| 57 |
+
"https://huggingface.co/blanchon/image-gs-models-utils/resolve/main/fused_ssim-0.0.1%2Bb4fd832pt2.6.0cu124-cp313-cp313-linux_x86_64.whl"
|
| 58 |
|
| 59 |
# Install dependencies with exact versions from lock file
|
| 60 |
RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
|
gradio_app.py
CHANGED
|
@@ -543,7 +543,7 @@ def create_interface():
|
|
| 543 |
info="Name for this training run",
|
| 544 |
)
|
| 545 |
num_gaussians = gr.Slider(
|
| 546 |
-
minimum=
|
| 547 |
maximum=50000,
|
| 548 |
value=10000,
|
| 549 |
step=1000,
|
|
|
|
| 543 |
info="Name for this training run",
|
| 544 |
)
|
| 545 |
num_gaussians = gr.Slider(
|
| 546 |
+
minimum=100,
|
| 547 |
maximum=50000,
|
| 548 |
value=10000,
|
| 549 |
step=1000,
|
gradio_models.py
CHANGED
|
@@ -152,7 +152,10 @@ class GradioGaussianSplatting2D(nn.Module):
|
|
| 152 |
self.gt_images = torch.from_numpy(self.gt_images).to(
|
| 153 |
dtype=self.dtype, device=self.device
|
| 154 |
)
|
| 155 |
-
self.img_h, self.img_w =
|
|
|
|
|
|
|
|
|
|
| 156 |
self.tile_bounds = (
|
| 157 |
int((self.img_w + self.block_w - 1) // self.block_w),
|
| 158 |
int((self.img_h + self.block_h - 1) // self.block_h),
|
|
@@ -394,13 +397,13 @@ class GradioGaussianSplatting2D(nn.Module):
|
|
| 394 |
xy, radii, conics, num_tiles_hit = tmp
|
| 395 |
|
| 396 |
# Ensure correct tensor types for CUDA backend
|
| 397 |
-
|
| 398 |
-
|
|
|
|
| 399 |
|
| 400 |
if not self.disable_tiles:
|
| 401 |
enable_topk_norm = not self.disable_topk_norm
|
| 402 |
|
| 403 |
-
|
| 404 |
out_image = rasterize_gaussians_sum(
|
| 405 |
xy,
|
| 406 |
radii,
|
|
@@ -481,8 +484,9 @@ class GradioGaussianSplatting2D(nn.Module):
|
|
| 481 |
xy, radii, conics, num_tiles_hit = tmp
|
| 482 |
|
| 483 |
# Ensure correct tensor types for CUDA backend
|
| 484 |
-
|
| 485 |
-
|
|
|
|
| 486 |
|
| 487 |
if not self.disable_tiles:
|
| 488 |
enable_topk_norm = not self.disable_topk_norm
|
|
|
|
| 152 |
self.gt_images = torch.from_numpy(self.gt_images).to(
|
| 153 |
dtype=self.dtype, device=self.device
|
| 154 |
)
|
| 155 |
+
self.img_h, self.img_w = (
|
| 156 |
+
int(self.gt_images.shape[1]),
|
| 157 |
+
int(self.gt_images.shape[2]),
|
| 158 |
+
)
|
| 159 |
self.tile_bounds = (
|
| 160 |
int((self.img_w + self.block_w - 1) // self.block_w),
|
| 161 |
int((self.img_h + self.block_h - 1) // self.block_h),
|
|
|
|
| 397 |
xy, radii, conics, num_tiles_hit = tmp
|
| 398 |
|
| 399 |
# Ensure correct tensor types for CUDA backend
|
| 400 |
+
# Note: The custom gsplat CUDA code expects int32 for both radii and num_tiles_hit
|
| 401 |
+
num_tiles_hit = num_tiles_hit.to(dtype=torch.int32)
|
| 402 |
+
radii = radii.to(dtype=torch.int32)
|
| 403 |
|
| 404 |
if not self.disable_tiles:
|
| 405 |
enable_topk_norm = not self.disable_topk_norm
|
| 406 |
|
|
|
|
| 407 |
out_image = rasterize_gaussians_sum(
|
| 408 |
xy,
|
| 409 |
radii,
|
|
|
|
| 484 |
xy, radii, conics, num_tiles_hit = tmp
|
| 485 |
|
| 486 |
# Ensure correct tensor types for CUDA backend
|
| 487 |
+
# Note: The custom gsplat CUDA code expects int32 for both radii and num_tiles_hit
|
| 488 |
+
num_tiles_hit = num_tiles_hit.to(dtype=torch.int32)
|
| 489 |
+
radii = radii.to(dtype=torch.int32)
|
| 490 |
|
| 491 |
if not self.disable_tiles:
|
| 492 |
enable_topk_norm = not self.disable_topk_norm
|
pyproject.docker.toml
CHANGED
|
@@ -3,7 +3,7 @@ name = "image-gs"
|
|
| 3 |
version = "0.1.0"
|
| 4 |
description = "Add your description here"
|
| 5 |
readme = "README.md"
|
| 6 |
-
requires-python = ">=3.
|
| 7 |
dependencies = [
|
| 8 |
"lpips>=0.1.4",
|
| 9 |
"matplotlib>=3.10.6",
|
|
@@ -21,16 +21,12 @@ dependencies = [
|
|
| 21 |
"huggingface_hub>=0.24.0",
|
| 22 |
]
|
| 23 |
|
| 24 |
-
# We use python 3.
|
| 25 |
[tool.uv.sources]
|
| 26 |
-
fused_ssim = { path = "wheels/fused_ssim-0.0.
|
| 27 |
-
gsplat = { path = "wheels/gsplat-0.1.0-
|
| 28 |
-
torch = [
|
| 29 |
-
|
| 30 |
-
]
|
| 31 |
-
torchvision = [
|
| 32 |
-
{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
|
| 33 |
-
]
|
| 34 |
|
| 35 |
|
| 36 |
[tool.uv.extra-build-dependencies]
|
|
@@ -42,7 +38,4 @@ url = "https://download.pytorch.org/whl/cu124"
|
|
| 42 |
explicit = true
|
| 43 |
|
| 44 |
[dependency-groups]
|
| 45 |
-
dev = [
|
| 46 |
-
"huggingface-hub[cli]>=0.34.4",
|
| 47 |
-
]
|
| 48 |
-
|
|
|
|
| 3 |
version = "0.1.0"
|
| 4 |
description = "Add your description here"
|
| 5 |
readme = "README.md"
|
| 6 |
+
requires-python = ">=3.13"
|
| 7 |
dependencies = [
|
| 8 |
"lpips>=0.1.4",
|
| 9 |
"matplotlib>=3.10.6",
|
|
|
|
| 21 |
"huggingface_hub>=0.24.0",
|
| 22 |
]
|
| 23 |
|
| 24 |
+
# We use python 3.13 and cu124 with PyTorch 2.6.0
|
| 25 |
[tool.uv.sources]
|
| 26 |
+
fused_ssim = { path = "wheels/fused_ssim-0.0.1+b4fd832pt2.6.0cu124-cp313-cp313-linux_x86_64.whl" }
|
| 27 |
+
gsplat = { path = "wheels/gsplat-0.1.0-cp313-cp313-linux_x86_64.whl" }
|
| 28 |
+
torch = [{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" }]
|
| 29 |
+
torchvision = [{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" }]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
[tool.uv.extra-build-dependencies]
|
|
|
|
| 38 |
explicit = true
|
| 39 |
|
| 40 |
[dependency-groups]
|
| 41 |
+
dev = ["huggingface-hub[cli]>=0.34.4"]
|
|
|
|
|
|
|
|
|
pyproject.toml
CHANGED
|
@@ -23,18 +23,14 @@ dependencies = [
|
|
| 23 |
|
| 24 |
# We use python 3.10 and cu124
|
| 25 |
[tool.uv.sources]
|
| 26 |
-
fused_ssim = {
|
| 27 |
gsplat = { path = "gsplat" }
|
| 28 |
-
torch = [
|
| 29 |
-
|
| 30 |
-
]
|
| 31 |
-
torchvision = [
|
| 32 |
-
{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
|
| 33 |
-
]
|
| 34 |
|
| 35 |
|
| 36 |
[tool.uv.extra-build-dependencies]
|
| 37 |
-
fused-ssim = ["torch", "numpy"]
|
| 38 |
gsplat = ["torch", "numpy"]
|
| 39 |
|
| 40 |
[[tool.uv.index]]
|
|
@@ -43,6 +39,4 @@ url = "https://download.pytorch.org/whl/cu124"
|
|
| 43 |
explicit = true
|
| 44 |
|
| 45 |
[dependency-groups]
|
| 46 |
-
dev = [
|
| 47 |
-
"huggingface-hub[cli]>=0.34.4",
|
| 48 |
-
]
|
|
|
|
| 23 |
|
| 24 |
# We use python 3.10 and cu124
|
| 25 |
[tool.uv.sources]
|
| 26 |
+
fused_ssim = { url = "https://github.com/MiroPsota/torch_packages_builder/releases/download/fused_ssim-0.0.1%2Bb4fd832/fused_ssim-0.0.1%2Bb4fd832pt2.6.0cu124-cp313-cp313-linux_x86_64.whl" }
|
| 27 |
gsplat = { path = "gsplat" }
|
| 28 |
+
torch = [{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" }]
|
| 29 |
+
torchvision = [{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" }]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
[tool.uv.extra-build-dependencies]
|
| 33 |
+
# fused-ssim = ["torch", "numpy"] # Not needed - using pre-built wheel
|
| 34 |
gsplat = ["torch", "numpy"]
|
| 35 |
|
| 36 |
[[tool.uv.index]]
|
|
|
|
| 39 |
explicit = true
|
| 40 |
|
| 41 |
[dependency-groups]
|
| 42 |
+
dev = ["huggingface-hub[cli]>=0.34.4"]
|
|
|
|
|
|
uv.lock
CHANGED
|
@@ -547,8 +547,11 @@ wheels = [
|
|
| 547 |
|
| 548 |
[[package]]
|
| 549 |
name = "fused-ssim"
|
| 550 |
-
version = "0.0.
|
| 551 |
-
source = {
|
|
|
|
|
|
|
|
|
|
| 552 |
|
| 553 |
[[package]]
|
| 554 |
name = "gradio"
|
|
@@ -770,7 +773,7 @@ dev = [
|
|
| 770 |
|
| 771 |
[package.metadata]
|
| 772 |
requires-dist = [
|
| 773 |
-
{ name = "fused-ssim",
|
| 774 |
{ name = "gradio", specifier = ">=4.0.0" },
|
| 775 |
{ name = "gsplat", directory = "gsplat" },
|
| 776 |
{ name = "huggingface-hub", specifier = ">=0.24.0" },
|
|
|
|
| 547 |
|
| 548 |
[[package]]
|
| 549 |
name = "fused-ssim"
|
| 550 |
+
version = "0.0.1+b4fd832pt2.6.0cu124"
|
| 551 |
+
source = { url = "https://github.com/MiroPsota/torch_packages_builder/releases/download/fused_ssim-0.0.1%2Bb4fd832/fused_ssim-0.0.1%2Bb4fd832pt2.6.0cu124-cp313-cp313-linux_x86_64.whl" }
|
| 552 |
+
wheels = [
|
| 553 |
+
{ url = "https://github.com/MiroPsota/torch_packages_builder/releases/download/fused_ssim-0.0.1%2Bb4fd832/fused_ssim-0.0.1%2Bb4fd832pt2.6.0cu124-cp313-cp313-linux_x86_64.whl", hash = "sha256:51c2b3302406ba972ab79dd31b3487eb282f1ba18a15e68ab11ea77b95bb0868" },
|
| 554 |
+
]
|
| 555 |
|
| 556 |
[[package]]
|
| 557 |
name = "gradio"
|
|
|
|
| 773 |
|
| 774 |
[package.metadata]
|
| 775 |
requires-dist = [
|
| 776 |
+
{ name = "fused-ssim", url = "https://github.com/MiroPsota/torch_packages_builder/releases/download/fused_ssim-0.0.1%2Bb4fd832/fused_ssim-0.0.1%2Bb4fd832pt2.6.0cu124-cp313-cp313-linux_x86_64.whl" },
|
| 777 |
{ name = "gradio", specifier = ">=4.0.0" },
|
| 778 |
{ name = "gsplat", directory = "gsplat" },
|
| 779 |
{ name = "huggingface-hub", specifier = ">=0.24.0" },
|