Spaces:
Running
on
Zero
Running
on
Zero
update
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ print('xformers version: {}'.format(xformers.__version__))
|
|
10 |
|
11 |
def install_cuda_toolkit():
|
12 |
# CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
|
13 |
-
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
|
14 |
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
15 |
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
16 |
subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
|
@@ -114,6 +114,9 @@ from utils.infer_utils import remove_background, resize_foreground
|
|
114 |
|
115 |
SEED = 0
|
116 |
|
|
|
|
|
|
|
117 |
def resize_to_224(img):
|
118 |
img = transforms.functional.resize(img, 518, # required by dino.
|
119 |
interpolation=transforms.InterpolationMode.LANCZOS)
|
@@ -147,7 +150,7 @@ def main(args_1, args_2):
|
|
147 |
dist_util.setup_dist(args_1)
|
148 |
logger.configure(dir=args_1.logdir)
|
149 |
|
150 |
-
th.cuda.empty_cache()
|
151 |
|
152 |
th.cuda.manual_seed_all(SEED)
|
153 |
np.random.seed(SEED)
|
@@ -170,9 +173,9 @@ def main(args_1, args_2):
|
|
170 |
|
171 |
opts = eg3d_options_default()
|
172 |
|
173 |
-
denoise_model_stage1.to(
|
174 |
denoise_model_stage1.eval()
|
175 |
-
denoise_model_stage2.to(
|
176 |
denoise_model_stage2.eval()
|
177 |
|
178 |
# * auto-encoder reconstruction model
|
@@ -181,7 +184,7 @@ def main(args_1, args_2):
|
|
181 |
**args_to_dict(args_1,
|
182 |
encoder_and_nsr_defaults().keys()))
|
183 |
|
184 |
-
auto_encoder.to(
|
185 |
auto_encoder.eval()
|
186 |
|
187 |
# faster inference
|
@@ -287,7 +290,7 @@ def main(args_1, args_2):
|
|
287 |
</div>
|
288 |
|
289 |
# GaussianAnything: Interactive Point Cloud Latent Diffusion for 3D Generation
|
290 |
-
**GaussianAnything is a native 3D diffusion model that supports high-quality 2D Gaussians generation.
|
291 |
It first trains a 3D VAE on **Objaverse**, which compress each 3D asset into a compact point cloud-structured latent.
|
292 |
After that, a image/text-conditioned diffusion model is trained following LDM paradigm.
|
293 |
The model used in the demo adopts 3D DiT architecture and flow-matching framework, and supports single-image condition.
|
|
|
10 |
|
11 |
def install_cuda_toolkit():
|
12 |
# CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
|
13 |
+
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run" # ! cu121 already installed
|
14 |
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
15 |
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
16 |
subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
|
|
|
114 |
|
115 |
SEED = 0
|
116 |
|
117 |
+
torch.set_grad_enabled(False)
|
118 |
+
device = torch.device('cuda')
|
119 |
+
|
120 |
def resize_to_224(img):
|
121 |
img = transforms.functional.resize(img, 518, # required by dino.
|
122 |
interpolation=transforms.InterpolationMode.LANCZOS)
|
|
|
150 |
dist_util.setup_dist(args_1)
|
151 |
logger.configure(dir=args_1.logdir)
|
152 |
|
153 |
+
# th.cuda.empty_cache()
|
154 |
|
155 |
th.cuda.manual_seed_all(SEED)
|
156 |
np.random.seed(SEED)
|
|
|
173 |
|
174 |
opts = eg3d_options_default()
|
175 |
|
176 |
+
denoise_model_stage1.to(device)
|
177 |
denoise_model_stage1.eval()
|
178 |
+
denoise_model_stage2.to(device)
|
179 |
denoise_model_stage2.eval()
|
180 |
|
181 |
# * auto-encoder reconstruction model
|
|
|
184 |
**args_to_dict(args_1,
|
185 |
encoder_and_nsr_defaults().keys()))
|
186 |
|
187 |
+
auto_encoder.to(device)
|
188 |
auto_encoder.eval()
|
189 |
|
190 |
# faster inference
|
|
|
290 |
</div>
|
291 |
|
292 |
# GaussianAnything: Interactive Point Cloud Latent Diffusion for 3D Generation
|
293 |
+
**GaussianAnything** is a native 3D diffusion model that supports high-quality 2D Gaussians generation.
|
294 |
It first trains a 3D VAE on **Objaverse**, which compress each 3D asset into a compact point cloud-structured latent.
|
295 |
After that, a image/text-conditioned diffusion model is trained following LDM paradigm.
|
296 |
The model used in the demo adopts 3D DiT architecture and flow-matching framework, and supports single-image condition.
|