Spaces:
Paused
Paused
Fix: replace PyPI nvdiffrast (doesn't exist) with Jeff Xiang's prebuilt wheel
Browse filesnvdiffrast is not published on PyPI — pip found zero matching distributions.
Use the prebuilt cp310 wheel from JeffreyXiang/Storages instead.
Also add try/except guards at the top of every @spaces.GPU baking function
so that if the wheel fails to load at runtime (e.g. ABI mismatch with
torch 2.8+) the Space still boots and the baking steps return a clear
error message rather than crashing the process.
Files changed (4)
37 unmodified lines3839404142434437 unmodified linesscipy # normal map dilation# ===== Milestone 5: Stage 2F Normal Baking =====nvdiffrast # PyPI version — compiles against installed CUDA at runtimecoacd==1.0.4 # Milestone 8 collision37 unmodified lines3839404142434445464737 unmodified linesscipy # normal map dilation# ===== Milestone 5: Stage 2F Normal Baking =====# nvdiffrast is not on PyPI — use Jeff Xiang's prebuilt wheel.# If this fails ABI checks at import time the baking functions# degrade gracefully (they catch ImportError internally).https://github.com/JeffreyXiang/Storages/releases/download/Space_Wheels_251210/nvdiffrast-0.4.0-cp310-cp310-linux_x86_64.whlcoacd==1.0.4 # Milestone 8 collision
55 unmodified lines56575859606162636464 unmodified lines12913013113213313413513613755 unmodified linesBake vertex-colour albedo from the high-poly to the low-poly UV atlas.Falls back to a neutral grey if the high-poly has no vertex colours."""import torchimport trimeshimport nvdiffrast.torch as drfrom PIL import Imagedevice = torch.device("cuda")64 unmodified linesBake metallic and roughness maps from high-poly vertex attributes.Returns (metallic_path, roughness_path, message)."""import torchimport trimeshimport nvdiffrast.torch as drfrom PIL import Imagedevice = torch.device("cuda")55 unmodified lines5657585960616263646566676864 unmodified lines13313413513613713813914014114214314414555 unmodified linesBake vertex-colour albedo from the high-poly to the low-poly UV atlas.Falls back to a neutral grey if the high-poly has no vertex colours."""try:import nvdiffrast.torch as drexcept Exception as e:return None, f"⚠️ nvdiffrast unavailable: {e}"import torchimport trimeshfrom PIL import Imagedevice = torch.device("cuda")64 unmodified linesBake metallic and roughness maps from high-poly vertex attributes.Returns (metallic_path, roughness_path, message)."""try:import nvdiffrast.torch as drexcept Exception as e:return None, None, f"⚠️ nvdiffrast unavailable: {e}"import torchimport trimeshfrom PIL import Imagedevice = torch.device("cuda")
66 unmodified lines67686970717273747566 unmodified linesquality: str = "Standard", # "Fast" | "Standard" | "High") -> tuple[Path, str]:"""Bake AO by hemisphere ray casting on the CPU (trimesh RayMesh intersector)."""import torchimport trimeshimport nvdiffrast.torch as drfrom PIL import Imagen_rays_map = {"Fast": 16, "Standard": 64, "High": 256}66 unmodified lines6768697071727374757677787966 unmodified linesquality: str = "Standard", # "Fast" | "Standard" | "High") -> tuple[Path, str]:"""Bake AO by hemisphere ray casting on the CPU (trimesh RayMesh intersector)."""try:import nvdiffrast.torch as drexcept Exception as e:return None, f"⚠️ nvdiffrast unavailable: {e}"import torchimport trimeshfrom PIL import Imagen_rays_map = {"Fast": 16, "Standard": 64, "High": 256}
83 unmodified lines84858687888990919283 unmodified linesdx_format: bool = True,) -> tuple[Path, Path, str]:"""Bake tangent-space normal maps. Returns (gl_path, dx_path, message)."""import torchimport trimeshimport nvdiffrast.torch as drfrom PIL import Imagedevice = torch.device("cuda")83 unmodified lines8485868788899091929394959683 unmodified linesdx_format: bool = True,) -> tuple[Path, Path, str]:"""Bake tangent-space normal maps. Returns (gl_path, dx_path, message)."""try:import nvdiffrast.torch as drexcept Exception as e:return None, None, f"⚠️ nvdiffrast unavailable: {e}"import torchimport trimeshfrom PIL import Imagedevice = torch.device("cuda")
requirements.txt+4-1
src/stages/stage2_bake_albedo.py+10-2
src/stages/stage2_bake_ao.py+5-1
src/stages/stage2_bake_normal.py+5-1