Spaces:
Sleeping
Sleeping
Fix some bugs.
Browse files- README.md +1 -1
- app.py +37 -11
- build-cuda-ext.sh +0 -22
- citydreamer/extensions/extrude_tensor/setup.py +6 -2
- citydreamer/extensions/grid_encoder/setup.py +12 -9
- wheels/extrude_tensor-1.0.0-cp310-cp310-linux_x86_64.whl +0 -3
- wheels/grid_encoder-1.0.0-cp310-cp310-linux_x86_64.whl +0 -3
- wheels/voxrender-1.0.0-cp310-cp310-linux_x86_64.whl +0 -3
README.md
CHANGED
@@ -15,5 +15,5 @@ Official demo for **[CityDreamer: Compositional Generative Model of Unbounded 3D
|
|
15 |
- 🤗 Try CityDreamer to generate photolistic 3D cities.
|
16 |
- ⚠️ Due to the limited computational resources at Hugging Face, this demo only generates **A SINGLE IMAGE** based on the New York City layout. If you wish to experience more comprehensive functionality, please visit the demo on [GitHub](https://github.com/hzxie/city-dreamer?tab=readme-ov-file#iterative-demo-%EF%B8%8F).
|
17 |
|
18 |
-
|
19 |
|
|
|
15 |
- 🤗 Try CityDreamer to generate photolistic 3D cities.
|
16 |
- ⚠️ Due to the limited computational resources at Hugging Face, this demo only generates **A SINGLE IMAGE** based on the New York City layout. If you wish to experience more comprehensive functionality, please visit the demo on [GitHub](https://github.com/hzxie/city-dreamer?tab=readme-ov-file#iterative-demo-%EF%B8%8F).
|
17 |
|
18 |
+
<p style="color:red">❕IMPORTANT NOTE: The HF team and we are currently working on migrating to ZeroGPU, so the demo may be temporarily unavailable.</p>
|
19 |
|
app.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
# @Author: Haozhe Xie
|
5 |
# @Date: 2024-03-02 16:30:00
|
6 |
# @Last Modified by: Haozhe Xie
|
7 |
-
# @Last Modified at: 2024-09-22
|
8 |
# @Email: root@haozhexie.com
|
9 |
|
10 |
import gradio as gr
|
@@ -36,23 +36,43 @@ def _get_output(cmd):
|
|
36 |
return None
|
37 |
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
def setup_runtime_env():
|
40 |
logging.info("Python Version: %s" % _get_output(["python", "--version"]))
|
41 |
logging.info("CUDA Version: %s" % _get_output(["nvcc", "--version"]))
|
42 |
logging.info("GCC Version: %s" % _get_output(["gcc", "--version"]))
|
|
|
|
|
43 |
|
44 |
# Install Pre-compiled CUDA extensions
|
45 |
-
ext_dir = os.path.join(os.path.dirname(__file__), "wheels")
|
46 |
-
for e in os.listdir(ext_dir):
|
47 |
-
logging.info("Installing Extensions from %s" % e)
|
48 |
-
subprocess.call(
|
49 |
-
["pip", "install", os.path.join(ext_dir, e)], stderr=subprocess.STDOUT
|
50 |
-
)
|
51 |
-
# Compile CUDA extensions
|
52 |
-
# ext_dir = os.path.join(os.path.dirname(__file__), "citydreamer", "extensions")
|
53 |
# for e in os.listdir(ext_dir):
|
54 |
-
#
|
55 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
logging.info("Installed Python Packages: %s" % _get_output(["pip", "list"]))
|
58 |
|
@@ -134,6 +154,12 @@ if __name__ == "__main__":
|
|
134 |
logging.basicConfig(
|
135 |
format="[%(levelname)s] %(asctime)s %(message)s", level=logging.INFO
|
136 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
logging.info("Compiling CUDA extensions...")
|
138 |
setup_runtime_env()
|
139 |
|
|
|
4 |
# @Author: Haozhe Xie
|
5 |
# @Date: 2024-03-02 16:30:00
|
6 |
# @Last Modified by: Haozhe Xie
|
7 |
+
# @Last Modified at: 2024-09-22 15:23:37
|
8 |
# @Email: root@haozhexie.com
|
9 |
|
10 |
import gradio as gr
|
|
|
36 |
return None
|
37 |
|
38 |
|
39 |
+
def install_cuda_toolkit():
|
40 |
+
# CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
|
41 |
+
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
|
42 |
+
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
43 |
+
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
44 |
+
subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
|
45 |
+
subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
|
46 |
+
|
47 |
+
os.environ["CUDA_HOME"] = "/usr/local/cuda"
|
48 |
+
os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
|
49 |
+
os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
|
50 |
+
os.environ["CUDA_HOME"],
|
51 |
+
"" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
|
52 |
+
)
|
53 |
+
# Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
|
54 |
+
os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
|
55 |
+
|
56 |
+
|
57 |
def setup_runtime_env():
|
58 |
logging.info("Python Version: %s" % _get_output(["python", "--version"]))
|
59 |
logging.info("CUDA Version: %s" % _get_output(["nvcc", "--version"]))
|
60 |
logging.info("GCC Version: %s" % _get_output(["gcc", "--version"]))
|
61 |
+
logging.info("CUDA is available: %s" % torch.cuda.is_available())
|
62 |
+
logging.info("CUDA Device Capability: %s" % (torch.cuda.get_device_capability(),))
|
63 |
|
64 |
# Install Pre-compiled CUDA extensions
|
65 |
+
# ext_dir = os.path.join(os.path.dirname(__file__), "wheels")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
# for e in os.listdir(ext_dir):
|
67 |
+
# logging.info("Installing Extensions from %s" % e)
|
68 |
+
# subprocess.call(
|
69 |
+
# ["pip", "install", os.path.join(ext_dir, e)], stderr=subprocess.STDOUT
|
70 |
+
# )
|
71 |
+
# Compile CUDA extensions
|
72 |
+
ext_dir = os.path.join(os.path.dirname(__file__), "citydreamer", "extensions")
|
73 |
+
for e in os.listdir(ext_dir):
|
74 |
+
if os.path.isdir(os.path.join(ext_dir, e)):
|
75 |
+
subprocess.call(["pip", "install", "."], cwd=os.path.join(ext_dir, e))
|
76 |
|
77 |
logging.info("Installed Python Packages: %s" % _get_output(["pip", "list"]))
|
78 |
|
|
|
154 |
logging.basicConfig(
|
155 |
format="[%(levelname)s] %(asctime)s %(message)s", level=logging.INFO
|
156 |
)
|
157 |
+
if _get_output(["nvcc", "--version"]) is None:
|
158 |
+
logging.info("Installing CUDA toolkit...")
|
159 |
+
install_cuda_toolkit()
|
160 |
+
else:
|
161 |
+
logging.info("Detected CUDA: %s" % _get_output(["nvcc", "--version"]))
|
162 |
+
|
163 |
logging.info("Compiling CUDA extensions...")
|
164 |
setup_runtime_env()
|
165 |
|
build-cuda-ext.sh
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
#
|
3 |
-
# @File: build-cuda-ext.sh
|
4 |
-
# @Author: Haozhe Xie
|
5 |
-
# @Date: 2024-09-22 10:43:34
|
6 |
-
# @Last Modified by: Haozhe Xie
|
7 |
-
# @Last Modified at: 2024-09-22 10:46:29
|
8 |
-
# @Email: root@haozhexie.com
|
9 |
-
|
10 |
-
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
11 |
-
EXTENSIONS_DIR="$SCRIPT_DIR/citydreamer/extensions"
|
12 |
-
WHEELS_DIR="$SCRIPT_DIR/wheels"
|
13 |
-
|
14 |
-
mkdir -p "$WHEELS_DIR"
|
15 |
-
|
16 |
-
for dir in "$EXTENSIONS_DIR"/*/; do
|
17 |
-
if [ -d "$dir" ]; then
|
18 |
-
echo "Processing $dir"
|
19 |
-
(cd "$dir" && pip wheel .)
|
20 |
-
mv "$dir"*.whl "$WHEELS_DIR"
|
21 |
-
fi
|
22 |
-
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
citydreamer/extensions/extrude_tensor/setup.py
CHANGED
@@ -4,22 +4,26 @@
|
|
4 |
# @Author: Haozhe Xie
|
5 |
# @Date: 2023-03-24 20:35:43
|
6 |
# @Last Modified by: Haozhe Xie
|
7 |
-
# @Last Modified at:
|
8 |
# @Email: root@haozhexie.com
|
9 |
|
10 |
from setuptools import setup
|
11 |
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
|
12 |
|
|
|
|
|
|
|
13 |
setup(
|
14 |
name="extrude_tensor",
|
15 |
version="1.0.0",
|
16 |
ext_modules=[
|
17 |
CUDAExtension(
|
18 |
"extrude_tensor_ext",
|
19 |
-
[
|
20 |
"bindings.cpp",
|
21 |
"extrude_tensor_ext.cu",
|
22 |
],
|
|
|
23 |
),
|
24 |
],
|
25 |
cmdclass={"build_ext": BuildExtension},
|
|
|
4 |
# @Author: Haozhe Xie
|
5 |
# @Date: 2023-03-24 20:35:43
|
6 |
# @Last Modified by: Haozhe Xie
|
7 |
+
# @Last Modified at: 2024-09-22 11:05:34
|
8 |
# @Email: root@haozhexie.com
|
9 |
|
10 |
from setuptools import setup
|
11 |
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
|
12 |
|
13 |
+
cxx_args = []
|
14 |
+
nvcc_args = ["-O3", "--gpu-architecture=compute_86", "--gpu-code=sm_86,compute_86"]
|
15 |
+
|
16 |
setup(
|
17 |
name="extrude_tensor",
|
18 |
version="1.0.0",
|
19 |
ext_modules=[
|
20 |
CUDAExtension(
|
21 |
"extrude_tensor_ext",
|
22 |
+
sources=[
|
23 |
"bindings.cpp",
|
24 |
"extrude_tensor_ext.cu",
|
25 |
],
|
26 |
+
extra_compile_args={"cxx": cxx_args, "nvcc": nvcc_args},
|
27 |
),
|
28 |
],
|
29 |
cmdclass={"build_ext": BuildExtension},
|
citydreamer/extensions/grid_encoder/setup.py
CHANGED
@@ -4,13 +4,22 @@
|
|
4 |
# @Author: Jiaxiang Tang (@ashawkey)
|
5 |
# @Date: 2023-04-15 10:33:32
|
6 |
# @Last Modified by: Haozhe Xie
|
7 |
-
# @Last Modified at:
|
8 |
# @Email: ashawkey1999@gmail.com
|
9 |
# @Ref: https://github.com/ashawkey/torch-ngp
|
10 |
|
11 |
from setuptools import setup
|
12 |
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
setup(
|
15 |
name="grid_encoder",
|
16 |
version="1.0.0",
|
@@ -22,14 +31,8 @@ setup(
|
|
22 |
"bindings.cpp",
|
23 |
],
|
24 |
extra_compile_args={
|
25 |
-
"cxx":
|
26 |
-
"nvcc":
|
27 |
-
"-O3",
|
28 |
-
"-std=c++17",
|
29 |
-
"-U__CUDA_NO_HALF_OPERATORS__",
|
30 |
-
"-U__CUDA_NO_HALF_CONVERSIONS__",
|
31 |
-
"-U__CUDA_NO_HALF2_OPERATORS__",
|
32 |
-
],
|
33 |
},
|
34 |
),
|
35 |
],
|
|
|
4 |
# @Author: Jiaxiang Tang (@ashawkey)
|
5 |
# @Date: 2023-04-15 10:33:32
|
6 |
# @Last Modified by: Haozhe Xie
|
7 |
+
# @Last Modified at: 2024-09-22 11:00:03
|
8 |
# @Email: ashawkey1999@gmail.com
|
9 |
# @Ref: https://github.com/ashawkey/torch-ngp
|
10 |
|
11 |
from setuptools import setup
|
12 |
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
|
13 |
|
14 |
+
cxx_args = ["-O3", "-std=c++17"]
|
15 |
+
nvcc_args = [
|
16 |
+
"-O3",
|
17 |
+
"-std=c++17",
|
18 |
+
"-U__CUDA_NO_HALF_OPERATORS__",
|
19 |
+
"-U__CUDA_NO_HALF_CONVERSIONS__",
|
20 |
+
"-U__CUDA_NO_HALF2_OPERATORS__",
|
21 |
+
]
|
22 |
+
|
23 |
setup(
|
24 |
name="grid_encoder",
|
25 |
version="1.0.0",
|
|
|
31 |
"bindings.cpp",
|
32 |
],
|
33 |
extra_compile_args={
|
34 |
+
"cxx": cxx_args,
|
35 |
+
"nvcc": nvcc_args,
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
},
|
37 |
),
|
38 |
],
|
wheels/extrude_tensor-1.0.0-cp310-cp310-linux_x86_64.whl
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:2c7e143d972796e4092b874de35bcca064885539352cfd9d3c652ad3a7a9ca40
|
3 |
-
size 237842
|
|
|
|
|
|
|
|
wheels/grid_encoder-1.0.0-cp310-cp310-linux_x86_64.whl
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:7de95ace4abdb055a0326538854eb1ce173440ac2b0be5fce1d4cfa81522ebc1
|
3 |
-
size 2345063
|
|
|
|
|
|
|
|
wheels/voxrender-1.0.0-cp310-cp310-linux_x86_64.whl
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:e56e7d57812d7778339e64b8bc2e14ea52eb37dead72c290650a163371a0cd4c
|
3 |
-
size 593569
|
|
|
|
|
|
|
|