JasonYinnnn commited on
Commit
c861666
·
1 Parent(s): d52a262
Files changed (3) hide show
  1. app.py +54 -0
  2. requirements.txt +1 -0
  3. scripts/check_packages.py +48 -0
app.py CHANGED
@@ -3,6 +3,60 @@
3
  # See the LICENSE file in the project root for full license information.
4
 
5
  import os
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  os.environ["GRADIO_TEMP_DIR"] = os.path.join(os.getcwd(), "gradio_temp")
7
  os.makedirs(os.environ["GRADIO_TEMP_DIR"], exist_ok=True)
8
  import uuid
 
3
  # See the LICENSE file in the project root for full license information.
4
 
5
  import os
6
+
7
+ from scripts.check_packages import (
8
+ install_flash_attn,
9
+ install_xformers,
10
+ install_kaolin,
11
+ install_nvdiffrast,
12
+ install_diffoctreerast,
13
+ install_vox2seq
14
+ )
15
+
16
+ # install flash-attn
17
+ try:
18
+ import flash_attn
19
+ except ModuleNotFoundError:
20
+ install_flash_attn()
21
+ import flash_attn
22
+
23
+ # install xformers
24
+ try:
25
+ import xformers
26
+ os.environ['ATTN_BACKEND'] = 'xformers'
27
+ except ModuleNotFoundError:
28
+ install_xformers()
29
+ import xformers
30
+ os.environ['ATTN_BACKEND'] = 'xformers'
31
+
32
+ # install kaolin
33
+ try:
34
+ import kaolin
35
+ except ModuleNotFoundError:
36
+ install_kaolin()
37
+ import kaolin
38
+
39
+ # install nvdiffrast
40
+ try:
41
+ import nvdiffrast
42
+ except ModuleNotFoundError:
43
+ install_nvdiffrast()
44
+ import nvdiffrast
45
+
46
+ # install diffoctreerast
47
+ try:
48
+ import diffoctreerast
49
+ except ModuleNotFoundError:
50
+ install_diffoctreerast()
51
+ import diffoctreerast
52
+
53
+ # install vox2seq
54
+ try:
55
+ import vox2seq
56
+ except ModuleNotFoundError:
57
+ install_vox2seq()
58
+ import vox2seq
59
+
60
  os.environ["GRADIO_TEMP_DIR"] = os.path.join(os.getcwd(), "gradio_temp")
61
  os.makedirs(os.environ["GRADIO_TEMP_DIR"], exist_ok=True)
62
  import uuid
requirements.txt CHANGED
@@ -30,3 +30,4 @@ pycocotools
30
  shapely
31
  gradio==4.44.1
32
  gradio_image_prompter
 
 
30
  shapely
31
  gradio==4.44.1
32
  gradio_image_prompter
33
+ spconv-cu118
scripts/check_packages.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ def install_flash_attn():
4
+ print ("installing flash-attn...")
5
+ result = os.system('pip install flash-attn')
6
+ print (result)
7
+
8
+ def install_xformers():
9
+ print ("installing xformers...")
10
+ result = os.system('pip install -U xformers --index-url https://download.pytorch.org/whl/cu129')
11
+ print (result)
12
+
13
+ def install_kaolin():
14
+ print ("installing kaolin...")
15
+ result = os.system('pip install kaolin==0.18.0 -f https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.8.0_cu129.html')
16
+ print (result)
17
+
18
+ def install_nvdiffrast():
19
+ print ("installing nvdiffrast...")
20
+ result = os.system('pip install git+https://github.com/NVlabs/nvdiffrast.git --no-build-isolation')
21
+ print (result)
22
+
23
+ def install_diffoctreerast():
24
+ print ("installing diffoctreerast...")
25
+ os.system('mkdir tmp')
26
+ os.system('mkdir tmp/extensions')
27
+ os.system('git clone --recurse-submodules https://github.com/JeffreyXiang/diffoctreerast.git ./tmp/extensions/diffoctreerast')
28
+ result = os.system('pip install ./tmp/extensions/diffoctreerast')
29
+ os.system('rm -rf ./tmp')
30
+ print (result)
31
+
32
+ def install_mipsplatting():
33
+ print ("installing mipsplatting...")
34
+ os.system('mkdir tmp')
35
+ os.system('mkdir tmp/extensions')
36
+ os.system('git clone https://github.com/autonomousvision/mip-splatting.git ./tmp/extensions/mip-splatting')
37
+ result = os.system('pip install ./tmp/extensions/mip-splatting/submodules/diff-gaussian-rasterization/')
38
+ os.system('rm -rf ./tmp')
39
+ print (result)
40
+
41
+ def install_vox2seq():
42
+ print ("installing vox2seq...")
43
+ os.system('mkdir tmp')
44
+ os.system('mkdir tmp/extensions')
45
+ os.system('git clone https://github.com/microsoft/TRELLIS.git@334d3b2fa1212477230ea1be989447273f389618 ./tmp/extensions/TRELLIS')
46
+ result = os.system('pip install ./tmp/extensions/TRELLIS/extensions/vox2seq')
47
+ os.system('rm -rf ./tmp')
48
+ print (result)