Update app.py
Browse files
app.py
CHANGED
@@ -243,7 +243,11 @@ def images_to_video(images, output_path, fps=30):
|
|
243 |
###############################################################################
|
244 |
# Configuration.
|
245 |
###############################################################################
|
246 |
-
|
|
|
|
|
|
|
|
|
247 |
seed_everything(0)
|
248 |
|
249 |
config_path = 'configs/PRM_inference.yaml'
|
@@ -356,21 +360,18 @@ def make_mesh(mesh_fpath, planes):
|
|
356 |
|
357 |
return mesh_fpath, mesh_glb_fpath
|
358 |
|
359 |
-
|
360 |
@spaces.GPU
|
361 |
def make3d(images):
|
362 |
-
os.environ['CUDA_HOME'] = '/usr/local/cuda-12.1'
|
363 |
-
os.environ['PATH'] += ':/usr/local/cuda-12.1/bin'
|
364 |
-
# os.environ['LD_LIBRARY_PATH'] += ':/usr/local/cuda-12.1/lib64'
|
365 |
-
os.environ['LD_LIBRARY_PATH'] = "/usr/local/cuda-12.1/lib64:" + os.environ.get('LD_LIBRARY_PATH', '')
|
366 |
-
|
367 |
# 验证 libnvrtc.so.12 是否能被加载
|
368 |
import ctypes
|
|
|
|
|
369 |
try:
|
370 |
-
ctypes.CDLL(
|
371 |
-
print("
|
372 |
except OSError as e:
|
373 |
-
print("Failed to
|
374 |
cuda_path = find_cuda()
|
375 |
|
376 |
if cuda_path:
|
|
|
243 |
###############################################################################
|
244 |
# Configuration.
|
245 |
###############################################################################
|
246 |
+
install_cuda_toolkit()
|
247 |
+
os.environ['CUDA_HOME'] = '/usr/local/cuda-12.1'
|
248 |
+
os.environ['PATH'] += ':/usr/local/cuda-12.1/bin'
|
249 |
+
# os.environ['LD_LIBRARY_PATH'] += ':/usr/local/cuda-12.1/lib64'
|
250 |
+
os.environ['LD_LIBRARY_PATH'] = "/usr/local/cuda-12.1/lib64:" + os.environ.get('LD_LIBRARY_PATH', '')
|
251 |
seed_everything(0)
|
252 |
|
253 |
config_path = 'configs/PRM_inference.yaml'
|
|
|
360 |
|
361 |
return mesh_fpath, mesh_glb_fpath
|
362 |
|
363 |
+
|
364 |
@spaces.GPU
|
365 |
def make3d(images):
|
|
|
|
|
|
|
|
|
|
|
366 |
# 验证 libnvrtc.so.12 是否能被加载
|
367 |
import ctypes
|
368 |
+
# 显式加载 libnvrtc.so.12
|
369 |
+
cuda_lib_path = "/usr/local/cuda-12.1/lib64/libnvrtc.so.12"
|
370 |
try:
|
371 |
+
ctypes.CDLL(cuda_lib_path, mode=ctypes.RTLD_GLOBAL)
|
372 |
+
print(f"Successfully preloaded {cuda_lib_path}")
|
373 |
except OSError as e:
|
374 |
+
print(f"Failed to preload {cuda_lib_path}: {e}")
|
375 |
cuda_path = find_cuda()
|
376 |
|
377 |
if cuda_path:
|