Huiwenshi commited on
Commit
884f63d
·
verified ·
1 Parent(s): 731a6bf

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. hg_app.py +24 -1
hg_app.py CHANGED
@@ -3,6 +3,18 @@ if True:
3
  import os
4
  import spaces
5
  import subprocess
 
 
 
 
 
 
 
 
 
 
 
 
6
  def install_cuda_toolkit():
7
  # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
8
  CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
@@ -21,8 +33,19 @@ if True:
21
  os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
22
 
23
  # install_cuda_toolkit()
 
 
 
 
 
 
 
 
 
24
  os.system("cd /home/user/app/hy3dgen/texgen/differentiable_renderer/ && bash compile_mesh_painter.sh")
25
- os.system("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && python3 -m pip install .")
 
 
26
  # os.system("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && CUDA_HOME=/usr/local/cuda FORCE_CUDA=1 TORCH_CUDA_ARCH_LIST='8.0;8.6;8.9;9.0' python setup.py install")
27
 
28
  IP = "0.0.0.0"
 
3
  import os
4
  import spaces
5
  import subprocess
6
+
7
+ def install_package(package_path):
8
+ # 确保 package_path 是绝对路径
9
+ package_path = os.path.abspath(package_path)
10
+
11
+ # 使用 subprocess 调用 setup.py
12
+ try:
13
+ subprocess.check_call([sys.executable, os.path.join(package_path, 'setup.py'), 'install'])
14
+ print(f"Package installed from {package_path}")
15
+ except subprocess.CalledProcessError as e:
16
+ print(f"Failed to install package from {package_path}: {e}")
17
+
18
  def install_cuda_toolkit():
19
  # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
20
  CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
 
33
  os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
34
 
35
  # install_cuda_toolkit()
36
+ print('which python')
37
+ os.system('which python')
38
+ print('which python3')
39
+ os.system('which python3')
40
+ print('which pip')
41
+ os.system('which pip')
42
+ print('which pip3')
43
+ os.system('which pip3')
44
+ print("cd /home/user/app/hy3dgen/texgen/differentiable_renderer/ && bash compile_mesh_painter.sh")
45
  os.system("cd /home/user/app/hy3dgen/texgen/differentiable_renderer/ && bash compile_mesh_painter.sh")
46
+ # print("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && python3 -m pip install .")
47
+ # os.system("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && python3 -m pip install .")
48
+ install_package("/home/user/app/hy3dgen/texgen/custom_rasterizer")
49
  # os.system("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && CUDA_HOME=/usr/local/cuda FORCE_CUDA=1 TORCH_CUDA_ARCH_LIST='8.0;8.6;8.9;9.0' python setup.py install")
50
 
51
  IP = "0.0.0.0"