Spaces:
Running
on
Zero
Running
on
Zero
NIRVANALAN
commited on
Commit
·
8e4a17a
1
Parent(s):
0a51705
update
Browse files- app.py +2 -2
- nsr/lsgm/flow_matching_trainer.py +7 -7
- nsr/train_util_diffusion.py +3 -3
app.py
CHANGED
|
@@ -236,7 +236,7 @@ def main(args):
|
|
| 236 |
eval_data=None,
|
| 237 |
**args)
|
| 238 |
|
| 239 |
-
@spaces.GPU(duration=
|
| 240 |
def reconstruct_and_export(*args, **kwargs):
|
| 241 |
return training_loop_class.eval_i23d_and_export(*args, **kwargs)
|
| 242 |
|
|
@@ -355,7 +355,7 @@ def main(args):
|
|
| 355 |
gr.Markdown(
|
| 356 |
"""
|
| 357 |
## Comments:
|
| 358 |
-
1.
|
| 359 |
2. The 3D viewer shows a colored .glb mesh extracted from volumetric tri-plane, and may differ slightly with the volume rendering result.
|
| 360 |
3. If you find your result unsatisfying, tune the CFG scale and change the random seed. Usually slightly increase the CFG value can lead to better performance.
|
| 361 |
3. Known limitations include:
|
|
|
|
| 236 |
eval_data=None,
|
| 237 |
**args)
|
| 238 |
|
| 239 |
+
@spaces.GPU(duration=30)
|
| 240 |
def reconstruct_and_export(*args, **kwargs):
|
| 241 |
return training_loop_class.eval_i23d_and_export(*args, **kwargs)
|
| 242 |
|
|
|
|
| 355 |
gr.Markdown(
|
| 356 |
"""
|
| 357 |
## Comments:
|
| 358 |
+
1. Each sample shall take within 20 seconds on Gradio ZeroSpace, and 6~7 seconds locally (A100).
|
| 359 |
2. The 3D viewer shows a colored .glb mesh extracted from volumetric tri-plane, and may differ slightly with the volume rendering result.
|
| 360 |
3. If you find your result unsatisfying, tune the CFG scale and change the random seed. Usually slightly increase the CFG value can lead to better performance.
|
| 361 |
3. Known limitations include:
|
nsr/lsgm/flow_matching_trainer.py
CHANGED
|
@@ -750,14 +750,14 @@ class FlowMatchingEngine(TrainLoop3DDiffusionLSGM_crossattn):
|
|
| 750 |
|
| 751 |
def sample_and_save(batch_c):
|
| 752 |
|
| 753 |
-
with th.cuda.amp.autocast(dtype=self.dtype,
|
| 754 |
-
|
| 755 |
|
| 756 |
-
|
| 757 |
-
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
|
| 762 |
for k in c:
|
| 763 |
if isinstance(c[k], th.Tensor):
|
|
|
|
| 750 |
|
| 751 |
def sample_and_save(batch_c):
|
| 752 |
|
| 753 |
+
# with th.cuda.amp.autocast(dtype=self.dtype,
|
| 754 |
+
# enabled=self.mp_trainer.use_amp):
|
| 755 |
|
| 756 |
+
c, uc = self.conditioner.get_unconditional_conditioning(
|
| 757 |
+
batch_c,
|
| 758 |
+
force_uc_zero_embeddings=ucg_keys
|
| 759 |
+
if len(self.conditioner.embedders) > 0 else [],
|
| 760 |
+
)
|
| 761 |
|
| 762 |
for k in c:
|
| 763 |
if isinstance(c[k], th.Tensor):
|
nsr/train_util_diffusion.py
CHANGED
|
@@ -205,8 +205,8 @@ class TrainLoopDiffusionWithRec(TrainLoop):
|
|
| 205 |
rec_model(latent=ddpm_latent,
|
| 206 |
behaviour='decode_after_vae_no_render'))
|
| 207 |
|
| 208 |
-
|
| 209 |
-
if False:
|
| 210 |
import mcubes
|
| 211 |
import trimesh
|
| 212 |
dump_path = f'{logger.get_dir()}/mesh/'
|
|
@@ -374,7 +374,7 @@ class TrainLoopDiffusionWithRec(TrainLoop):
|
|
| 374 |
print('logged video to: ', f'{vid_dump_path}')
|
| 375 |
|
| 376 |
del vis, pred_vis, micro, pred,
|
| 377 |
-
mesh_dump_path = 'logs/LSGM/inference/Objaverse/i23d/dit-L2/gradio_app/mesh/cfg=4.0_sample-0-rotatex.obj'
|
| 378 |
|
| 379 |
return vid_dump_path, mesh_dump_path
|
| 380 |
|
|
|
|
| 205 |
rec_model(latent=ddpm_latent,
|
| 206 |
behaviour='decode_after_vae_no_render'))
|
| 207 |
|
| 208 |
+
if export_mesh:
|
| 209 |
+
# if False:
|
| 210 |
import mcubes
|
| 211 |
import trimesh
|
| 212 |
dump_path = f'{logger.get_dir()}/mesh/'
|
|
|
|
| 374 |
print('logged video to: ', f'{vid_dump_path}')
|
| 375 |
|
| 376 |
del vis, pred_vis, micro, pred,
|
| 377 |
+
# mesh_dump_path = 'logs/LSGM/inference/Objaverse/i23d/dit-L2/gradio_app/mesh/cfg=4.0_sample-0-rotatex.obj'
|
| 378 |
|
| 379 |
return vid_dump_path, mesh_dump_path
|
| 380 |
|