Spaces:
Running on Zero
Running on Zero
Move mvadapter+stablenormal to runtime --no-deps (over-pinned conflicting deps)
Browse files- app.py +16 -7
- requirements.txt +3 -2
app.py
CHANGED
|
@@ -28,14 +28,21 @@ from pathlib import Path
|
|
| 28 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 29 |
_RUNTIME_PKG_MARKER = Path("/tmp/.runtime_pkgs_installed")
|
| 30 |
|
| 31 |
-
# Packages requiring --no-build-isolation (chumpy transitive dep
|
| 32 |
_NO_ISOLATION_PACKAGES = [
|
| 33 |
"chumpy @ git+https://github.com/mattloper/chumpy.git@580566eafc9ac68b2614b64d6f7aaa84eebb70da",
|
| 34 |
"hmr2 @ git+https://github.com/shubham-goel/4D-Humans.git@efe18deff163b29dff87ddbd575fa29b716a356c",
|
| 35 |
"skel @ git+https://github.com/MarilynKeller/SKEL.git@c32cf16581295bff19399379efe5b776d707cd95",
|
| 36 |
]
|
| 37 |
|
| 38 |
-
# Packages
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
_CUDA_PACKAGES = [
|
| 40 |
"nvdiffrast @ git+https://github.com/NVlabs/nvdiffrast.git@253ac4fcea7de5f396371124af597e6cc957bfae",
|
| 41 |
"diso @ git+https://github.com/SarahWeiii/diso.git@9792ad928ccb09bdec938779651ee03e395758a6",
|
|
@@ -45,16 +52,18 @@ _CUDA_PACKAGES = [
|
|
| 45 |
def _install_runtime_packages():
|
| 46 |
if _RUNTIME_PKG_MARKER.exists():
|
| 47 |
return
|
| 48 |
-
print("[startup] Installing runtime packages (first run, ~
|
| 49 |
subprocess.run(
|
| 50 |
[sys.executable, "-m", "pip", "install", "--quiet", "--no-build-isolation"]
|
| 51 |
-
+ _NO_ISOLATION_PACKAGES,
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
| 53 |
)
|
| 54 |
subprocess.run(
|
| 55 |
[sys.executable, "-m", "pip", "install", "--quiet"]
|
| 56 |
-
+ _CUDA_PACKAGES,
|
| 57 |
-
check=True,
|
| 58 |
)
|
| 59 |
_RUNTIME_PKG_MARKER.touch()
|
| 60 |
print("[startup] Runtime packages installed.")
|
|
|
|
| 28 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 29 |
_RUNTIME_PKG_MARKER = Path("/tmp/.runtime_pkgs_installed")
|
| 30 |
|
| 31 |
+
# 1. Packages requiring --no-build-isolation (chumpy transitive dep via hmr2/skel)
|
| 32 |
_NO_ISOLATION_PACKAGES = [
|
| 33 |
"chumpy @ git+https://github.com/mattloper/chumpy.git@580566eafc9ac68b2614b64d6f7aaa84eebb70da",
|
| 34 |
"hmr2 @ git+https://github.com/shubham-goel/4D-Humans.git@efe18deff163b29dff87ddbd575fa29b716a356c",
|
| 35 |
"skel @ git+https://github.com/MarilynKeller/SKEL.git@c32cf16581295bff19399379efe5b776d707cd95",
|
| 36 |
]
|
| 37 |
|
| 38 |
+
# 2. Packages with over-pinned deps that conflict with our stack; install --no-deps
|
| 39 |
+
# (their actual runtime imports only need the packages already in our requirements)
|
| 40 |
+
_NO_DEPS_PACKAGES = [
|
| 41 |
+
"mvadapter @ git+https://github.com/huanngzh/MV-Adapter.git@4277e0018232bac82bb2c103caf0893cedb711be",
|
| 42 |
+
"stablenormal @ git+https://github.com/Stable-X/StableNormal.git@594b934630ab3bc71f35c77d14ec7feb98480cd0",
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
# 3. Packages requiring nvcc (CUDA compiler only in runtime GPU containers)
|
| 46 |
_CUDA_PACKAGES = [
|
| 47 |
"nvdiffrast @ git+https://github.com/NVlabs/nvdiffrast.git@253ac4fcea7de5f396371124af597e6cc957bfae",
|
| 48 |
"diso @ git+https://github.com/SarahWeiii/diso.git@9792ad928ccb09bdec938779651ee03e395758a6",
|
|
|
|
| 52 |
def _install_runtime_packages():
|
| 53 |
if _RUNTIME_PKG_MARKER.exists():
|
| 54 |
return
|
| 55 |
+
print("[startup] Installing runtime packages (first run, ~10-15 min)...")
|
| 56 |
subprocess.run(
|
| 57 |
[sys.executable, "-m", "pip", "install", "--quiet", "--no-build-isolation"]
|
| 58 |
+
+ _NO_ISOLATION_PACKAGES, check=True,
|
| 59 |
+
)
|
| 60 |
+
subprocess.run(
|
| 61 |
+
[sys.executable, "-m", "pip", "install", "--quiet", "--no-deps"]
|
| 62 |
+
+ _NO_DEPS_PACKAGES, check=True,
|
| 63 |
)
|
| 64 |
subprocess.run(
|
| 65 |
[sys.executable, "-m", "pip", "install", "--quiet"]
|
| 66 |
+
+ _CUDA_PACKAGES, check=True,
|
|
|
|
| 67 |
)
|
| 68 |
_RUNTIME_PKG_MARKER.touch()
|
| 69 |
print("[startup] Runtime packages installed.")
|
requirements.txt
CHANGED
|
@@ -10,7 +10,8 @@ spaces
|
|
| 10 |
# - nvdiffrast/diso/detectron2 require nvcc (NVIDIA CUDA compiler) which is only
|
| 11 |
# available in the ZeroGPU runtime container, not the Docker build stage.
|
| 12 |
clip @ git+https://github.com/openai/CLIP.git@d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
|
| 13 |
-
mvadapter
|
|
|
|
| 14 |
|
| 15 |
# Core ML
|
| 16 |
accelerate
|
|
@@ -51,7 +52,7 @@ facexlib
|
|
| 51 |
face-alignment
|
| 52 |
|
| 53 |
# Surface enhancement
|
| 54 |
-
stablenormal
|
| 55 |
controlnet_aux
|
| 56 |
|
| 57 |
# CV
|
|
|
|
| 10 |
# - nvdiffrast/diso/detectron2 require nvcc (NVIDIA CUDA compiler) which is only
|
| 11 |
# available in the ZeroGPU runtime container, not the Docker build stage.
|
| 12 |
clip @ git+https://github.com/openai/CLIP.git@d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
|
| 13 |
+
# mvadapter and stablenormal use over-pinned deps (opencv-python vs headless, diffusers==0.28.0)
|
| 14 |
+
# installed at runtime with --no-deps in app.py
|
| 15 |
|
| 16 |
# Core ML
|
| 17 |
accelerate
|
|
|
|
| 52 |
face-alignment
|
| 53 |
|
| 54 |
# Surface enhancement
|
| 55 |
+
# stablenormal: installed at runtime with --no-deps (it pins diffusers==0.28.0)
|
| 56 |
controlnet_aux
|
| 57 |
|
| 58 |
# CV
|