bluestyle97 commited on
Commit
a1e1b30
1 Parent(s): 98b34b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import os
2
  if 'OMP_NUM_THREADS' not in os.environ:
3
  os.environ['OMP_NUM_THREADS'] = '16'
4
  import torch
 
5
  import gradio as gr
6
  from functools import partial
7
  from huggingface_hub import snapshot_download
@@ -10,6 +11,25 @@ from freesplatter.webui.runner import FreeSplatterRunner
10
  from freesplatter.webui.tab_img_to_3d import create_interface_img_to_3d
11
 
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  torch.set_grad_enabled(False)
14
  device = torch.device('cuda')
15
  runner = FreeSplatterRunner(device)
 
2
  if 'OMP_NUM_THREADS' not in os.environ:
3
  os.environ['OMP_NUM_THREADS'] = '16'
4
  import torch
5
+ import subprocess
6
  import gradio as gr
7
  from functools import partial
8
  from huggingface_hub import snapshot_download
 
11
  from freesplatter.webui.tab_img_to_3d import create_interface_img_to_3d
12
 
13
 
14
+ def install_cuda_toolkit():
15
+ CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run"
16
+ CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
17
+ subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
18
+ subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
19
+ subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
20
+
21
+ os.environ["CUDA_HOME"] = "/usr/local/cuda"
22
+ os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
23
+ os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
24
+ os.environ["CUDA_HOME"],
25
+ "" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
26
+ )
27
+ # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
28
+ os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
29
+
30
+ install_cuda_toolkit()
31
+
32
+
33
  torch.set_grad_enabled(False)
34
  device = torch.device('cuda')
35
  runner = FreeSplatterRunner(device)