Spaces:
Running
on
L40S
Running
on
L40S
Upload app_hg.py with huggingface_hub
Browse files
app_hg.py
CHANGED
|
@@ -48,10 +48,8 @@ from glob import glob
|
|
| 48 |
# # Optionally, update PATH and LD_LIBRARY_PATH if needed
|
| 49 |
# os.environ['PATH'] = os.environ['CUDA_HOME'] + '/bin:' + os.environ['PATH']
|
| 50 |
# os.environ['LD_LIBRARY_PATH'] = os.environ['CUDA_HOME'] + '/lib64:' + os.environ.get('LD_LIBRARY_PATH', '')
|
| 51 |
-
|
| 52 |
# check_env()
|
| 53 |
|
| 54 |
-
@spaces.GPU
|
| 55 |
def install_cuda_toolkit():
|
| 56 |
# CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
|
| 57 |
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
|
|
@@ -68,20 +66,18 @@ def install_cuda_toolkit():
|
|
| 68 |
)
|
| 69 |
# Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
|
| 70 |
os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
@spaces.GPU
|
| 79 |
-
def install_requirements():
|
| 80 |
-
# Install the packages listed in requirements.txt
|
| 81 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
|
| 82 |
-
|
| 83 |
install_cuda_toolkit()
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
from infer import seed_everything, save_gif
|
| 87 |
from infer import Text2Image, Removebg, Image2Views, Views2Mesh, GifRenderer
|
|
|
|
| 48 |
# # Optionally, update PATH and LD_LIBRARY_PATH if needed
|
| 49 |
# os.environ['PATH'] = os.environ['CUDA_HOME'] + '/bin:' + os.environ['PATH']
|
| 50 |
# os.environ['LD_LIBRARY_PATH'] = os.environ['CUDA_HOME'] + '/lib64:' + os.environ.get('LD_LIBRARY_PATH', '')
|
|
|
|
| 51 |
# check_env()
|
| 52 |
|
|
|
|
| 53 |
def install_cuda_toolkit():
|
| 54 |
# CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
|
| 55 |
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
|
|
|
|
| 66 |
)
|
| 67 |
# Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
|
| 68 |
os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
|
| 69 |
+
try:
|
| 70 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "-U", "git+https://github.com/facebookresearch/pytorch3d@stable"])
|
| 71 |
+
import pytorch3d
|
| 72 |
+
except Exception as err:
|
| 73 |
+
print(err)
|
| 74 |
+
print("new inner cuda install pytorch3d fail")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
install_cuda_toolkit()
|
| 76 |
+
|
| 77 |
+
# def install_requirements():
|
| 78 |
+
# # Install the packages listed in requirements.txt
|
| 79 |
+
# subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
|
| 80 |
+
#install_requirements()
|
| 81 |
|
| 82 |
from infer import seed_everything, save_gif
|
| 83 |
from infer import Text2Image, Removebg, Image2Views, Views2Mesh, GifRenderer
|