ziqima commited on
Commit
313fd51
·
1 Parent(s): 3b7081a

install conda

Browse files
Files changed (2) hide show
  1. app.py +3 -1
  2. utils.py +18 -0
app.py CHANGED
@@ -1,12 +1,14 @@
1
  import gradio as gr
2
  import re
3
- from utils import read_pcd, render_point_cloud, render_pcd_file, set_seed
4
  from inference.utils import get_legend
5
  from inference.inference import segment_obj, get_heatmap
6
  from huggingface_hub import login
7
  import os
8
 
9
 
 
 
10
  os.chdir("Pointcept/libs/pointops")
11
  os.system("python setup.py install")
12
  os.chdir("../../../")
 
1
  import gradio as gr
2
  import re
3
+ from utils import read_pcd, render_point_cloud, render_pcd_file, set_seed, install_cuda_toolkit
4
  from inference.utils import get_legend
5
  from inference.inference import segment_obj, get_heatmap
6
  from huggingface_hub import login
7
  import os
8
 
9
 
10
+ install_cuda_toolkit()
11
+
12
  os.chdir("Pointcept/libs/pointops")
13
  os.system("python setup.py install")
14
  os.chdir("../../../")
utils.py CHANGED
@@ -4,7 +4,25 @@ import numpy as np
4
  import textwrap
5
  import torch
6
  import random
 
 
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  def set_seed():
10
  seed = 123
 
4
  import textwrap
5
  import torch
6
  import random
7
+ import os
8
+ import subprocess
9
 
10
+ def install_cuda_toolkit():
11
+ # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
12
+ CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
13
+ CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
14
+ subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
15
+ subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
16
+ subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
17
+
18
+ os.environ["CUDA_HOME"] = "/usr/local/cuda"
19
+ os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
20
+ os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
21
+ os.environ["CUDA_HOME"],
22
+ "" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
23
+ )
24
+ # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
25
+ os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
26
 
27
  def set_seed():
28
  seed = 123