alexnasa commited on
Commit
ea3185b
·
verified ·
1 Parent(s): e42e346

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -46
app.py CHANGED
@@ -16,52 +16,52 @@ from huggingface_hub import snapshot_download
16
  from PIL import Image
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.check_call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
35
- subprocess.check_call(["chmod", "+x", CUDA_TOOLKIT_FILE])
36
- subprocess.check_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
- # add for compiler header lookup
45
- os.environ["CPATH"] = f"{os.environ['CUDA_HOME']}/include" + (
46
- f":{os.environ['CPATH']}" if "CPATH" in os.environ else ""
47
- )
48
- # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
49
- # os.environ["TORCH_CUDA_ARCH_LIST"] = "9.0"
50
- print("==> finished installation")
51
-
52
- print("installing cuda toolkit")
53
- install_cuda_toolkit()
54
- print("finished")
55
-
56
- header_path = "/usr/local/cuda/include/cuda_runtime.h"
57
- print(f"{header_path} exists:", os.path.exists(header_path))
58
-
59
- # my_env = os.environ.copy()
60
- subprocess.run(["pip", "install","diso"], check=True)
61
-
62
-
63
- # tell Python to re-scan site-packages now that the egg-link exists
64
- import importlib, site; site.addsitedir(site.getsitepackages()[0]); importlib.invalidate_caches()
65
 
66
 
67
  from src.utils.data_utils import get_colored_mesh_composition, scene_to_parts, load_surfaces
 
16
  from PIL import Image
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.check_call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
35
+ # subprocess.check_call(["chmod", "+x", CUDA_TOOLKIT_FILE])
36
+ # subprocess.check_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
+ # # add for compiler header lookup
45
+ # os.environ["CPATH"] = f"{os.environ['CUDA_HOME']}/include" + (
46
+ # f":{os.environ['CPATH']}" if "CPATH" in os.environ else ""
47
+ # )
48
+ # # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
49
+ # # os.environ["TORCH_CUDA_ARCH_LIST"] = "9.0"
50
+ # print("==> finished installation")
51
+
52
+ # print("installing cuda toolkit")
53
+ # install_cuda_toolkit()
54
+ # print("finished")
55
+
56
+ # header_path = "/usr/local/cuda/include/cuda_runtime.h"
57
+ # print(f"{header_path} exists:", os.path.exists(header_path))
58
+
59
+ # # my_env = os.environ.copy()
60
+ # subprocess.run(["pip", "install","diso"], check=True)
61
+
62
+
63
+ # # tell Python to re-scan site-packages now that the egg-link exists
64
+ # import importlib, site; site.addsitedir(site.getsitepackages()[0]); importlib.invalidate_caches()
65
 
66
 
67
  from src.utils.data_utils import get_colored_mesh_composition, scene_to_parts, load_surfaces