forked from yindaheng98/InstantSplat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
113 lines (103 loc) · 4.56 KB
/
Copy pathsetup.py
File metadata and controls
113 lines (103 loc) · 4.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#
# Copyright (C) 2023, Inria
# GRAPHDECO research group, https://team.inria.fr/graphdeco
# All rights reserved.
#
# This software is free for non-commercial, research and evaluation use
# under the terms of the LICENSE.md file.
#
# For inquiries contact george.drettakis@inria.fr
#
from setuptools import setup, find_packages, find_namespace_packages
from torch import cuda
from torch.utils.cpp_extension import CUDAExtension, BuildExtension
import os
with open("README.md", "r", encoding='utf8') as fh:
long_description = fh.read()
packages = ['instantsplat'] + ["instantsplat." + package for package in find_packages(where="instantsplat")]
packages_dust3r = ['dust3r'] + ["dust3r." + package for package in find_packages(where="submodules/dust3r/dust3r")]
packages_mast3r = ['mast3r'] + ["mast3r." + package for package in find_packages(where="submodules/mast3r/mast3r")]
packages_croco = ['croco', 'croco.utils', 'croco.models', 'croco.models.curope']
packages_depth_anything_v2 = ['depth_anything_v2'] + ["depth_anything_v2." + package for package in find_namespace_packages(where="submodules/Depth-Anything-V2/depth_anything_v2")]
packages_dust3r += ["dust3r.dust3r"] # ugly workaround for agly MAST3R import
os.makedirs("submodules/dust3r/dust3r/dust3r", exist_ok=True) # ugly workaround for ugly MAST3R import
with open("submodules/dust3r/dust3r/dust3r/__init__.py", "w") as f:
f.write("\n")
cxx_compiler_flags = []
nvcc_compiler_flags = []
# compile for all possible CUDA architectures
all_cuda_archs = cuda.get_gencode_flags().replace('compute=', 'arch=').split()
# alternatively, you can list cuda archs that you want, eg:
# all_cuda_archs = [
# '-gencode', 'arch=compute_70,code=sm_70',
# '-gencode', 'arch=compute_75,code=sm_75',
# '-gencode', 'arch=compute_80,code=sm_80',
# '-gencode', 'arch=compute_86,code=sm_86'
# ]
if os.name == 'nt':
cxx_compiler_flags.append("/wd4624")
nvcc_compiler_flags.append("-allow-unsupported-compiler")
pypi_build = os.environ.get("PYPI_BUILD", "").lower() in {"1", "true", "yes", "on"}
MAP_ANYTHING_REPO = "git+https://github.com/facebookresearch/map-anything.git@main"
setup(
name="instantsplat",
version='1.15.4',
author='yindaheng98',
author_email='yindaheng98@gmail.com',
url='https://github.com/yindaheng98/instantsplat',
description=u'Refactored python initialization and training code for InstantSplat',
long_description=long_description,
long_description_content_type="text/markdown",
packages=packages + packages_dust3r + packages_mast3r + packages_croco + packages_depth_anything_v2,
package_dir={
'instantsplat': 'instantsplat',
'dust3r': 'submodules/dust3r/dust3r',
'mast3r': 'submodules/mast3r/mast3r',
'croco': 'submodules/dust3r/croco',
'depth_anything_v2': 'submodules/Depth-Anything-V2/depth_anything_v2',
},
ext_modules=[
CUDAExtension(
name='croco.models.curope.curope',
sources=[
"submodules/dust3r/croco/models/curope/curope.cpp",
"submodules/dust3r/croco/models/curope/kernels.cu",
],
extra_compile_args=dict(
nvcc=nvcc_compiler_flags+['-O3', '--ptxas-options=-v', "--use_fast_math"]+all_cuda_archs,
cxx=['-O3'])
)
],
cmdclass={
'build_ext': BuildExtension
},
install_requires=[
'gaussian-splatting >= 2.3.8',
'scikit-learn',
# deps for dust3r
'scipy',
'huggingface_hub',
'einops',
'roma',
]+([
# VGGT and its dependencies
'Pillow',
'hydra-core',
'omegaconf',
'vggt @ git+https://github.com/facebookresearch/vggt.git',
'lightglue @ git+https://github.com/jytime/LightGlue.git#egg=lightglue',
# mapanything and its dependencies
f'mapanything @ {MAP_ANYTHING_REPO}',
] if not pypi_build else []),
extras_require={
'dust3r': [f'mapanything[dust3r] @ {MAP_ANYTHING_REPO}'],
'mast3r': [f'mapanything[mast3r] @ {MAP_ANYTHING_REPO}'],
'pi3': [f'mapanything[pi3] @ {MAP_ANYTHING_REPO}'],
'pow3r': [f'mapanything[pow3r] @ {MAP_ANYTHING_REPO}'],
'anycalib': [f'mapanything[anycalib] @ {MAP_ANYTHING_REPO}'],
'must3r': [f'mapanything[must3r] @ {MAP_ANYTHING_REPO}'],
'depth-anything-3': [f'mapanything[depth-anything-3] @ {MAP_ANYTHING_REPO}'],
'all': [f'mapanything[all] @ {MAP_ANYTHING_REPO}'],
} if not pypi_build else {},
)
os.remove("submodules/dust3r/dust3r/dust3r/__init__.py") # ugly workaround for ugly MAST3R import