Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,11 +17,42 @@ from PIL import Image
|
|
| 17 |
from accelerate.utils import set_seed
|
| 18 |
|
| 19 |
import subprocess
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
from src.utils.data_utils import get_colored_mesh_composition, scene_to_parts, load_surfaces
|
|
@@ -125,4 +156,4 @@ def build_demo():
|
|
| 125 |
|
| 126 |
if __name__ == "__main__":
|
| 127 |
demo = build_demo()
|
| 128 |
-
demo.launch()
|
|
|
|
| 17 |
from accelerate.utils import set_seed
|
| 18 |
|
| 19 |
import subprocess
|
| 20 |
+
import importlib, site, sys
|
| 21 |
|
| 22 |
+
# Re-discover all .pth/.egg-link files
|
| 23 |
+
for sitedir in site.getsitepackages():
|
| 24 |
+
site.addsitedir(sitedir)
|
| 25 |
+
|
| 26 |
+
# Clear caches so importlib will pick up new modules
|
| 27 |
+
importlib.invalidate_caches()
|
| 28 |
+
|
| 29 |
+
def sh(cmd): subprocess.check_call(cmd, shell=True)
|
| 30 |
+
|
| 31 |
+
def install_cuda_toolkit():
|
| 32 |
+
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.6.0/local_installers/cuda_12.6.0_560.28.03_linux.run"
|
| 33 |
+
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
| 34 |
+
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
| 35 |
+
subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
|
| 36 |
+
subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
|
| 37 |
+
|
| 38 |
+
os.environ["CUDA_HOME"] = "/usr/local/cuda"
|
| 39 |
+
os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
|
| 40 |
+
os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
|
| 41 |
+
os.environ["CUDA_HOME"],
|
| 42 |
+
"" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
|
| 43 |
+
)
|
| 44 |
+
# Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
|
| 45 |
+
os.environ["TORCH_CUDA_ARCH_LIST"] = "9.0"
|
| 46 |
+
print("==> finished installation")
|
| 47 |
+
|
| 48 |
+
install_cuda_toolkit()
|
| 49 |
+
|
| 50 |
+
my_env = os.environ.copy()
|
| 51 |
+
subprocess.run(["pip", "install","diso"], check=True, env=my_env)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
# tell Python to re-scan site-packages now that the egg-link exists
|
| 55 |
+
import importlib, site; site.addsitedir(site.getsitepackages()[0]); importlib.invalidate_caches()
|
| 56 |
|
| 57 |
|
| 58 |
from src.utils.data_utils import get_colored_mesh_composition, scene_to_parts, load_surfaces
|
|
|
|
| 156 |
|
| 157 |
if __name__ == "__main__":
|
| 158 |
demo = build_demo()
|
| 159 |
+
demo.launch()
|