Spaces:
Running
on
Zero
Running
on
Zero
kxhit
commited on
Commit
·
580e407
1
Parent(s):
57cc7d0
cuda reinit
Browse files
app.py
CHANGED
@@ -107,10 +107,12 @@ pipeline.image_encoder = image_encoder.to(weight_dtype)
|
|
107 |
|
108 |
pipeline.set_progress_bar_config(disable=False)
|
109 |
|
|
|
|
|
110 |
# pipeline.enable_xformers_memory_efficient_attention()
|
111 |
# enable vae slicing
|
112 |
pipeline.enable_vae_slicing()
|
113 |
-
|
114 |
|
115 |
|
116 |
|
@@ -180,8 +182,8 @@ def run_eschernet(eschernet_input_dict, sample_steps, sample_seed, nvs_num, nvs_
|
|
180 |
assert T_out == pose_out.shape[1]
|
181 |
|
182 |
# run inference
|
183 |
-
pipeline.to(device)
|
184 |
-
pipeline.enable_xformers_memory_efficient_attention()
|
185 |
if CaPE_TYPE == "6DoF":
|
186 |
with torch.autocast("cuda"):
|
187 |
image = pipeline(input_imgs=input_image, prompt_imgs=input_image,
|
@@ -334,8 +336,6 @@ def get_reconstructed_scene(filelist, schedule, niter, min_conf_thr,
|
|
334 |
"""
|
335 |
silent = False
|
336 |
image_size = 224
|
337 |
-
weights_path = 'checkpoints/DUSt3R_ViTLarge_BaseDecoder_224_linear.pth'
|
338 |
-
model = AsymmetricCroCo3DStereo.from_pretrained(weights_path).to(device)
|
339 |
# remove the directory if it already exists
|
340 |
outdir = tmpdirname
|
341 |
if os.path.exists(outdir):
|
@@ -531,9 +531,8 @@ def preview_input(inputfiles):
|
|
531 |
# dustr init
|
532 |
silent = False
|
533 |
image_size = 224
|
534 |
-
|
535 |
-
|
536 |
-
model=None
|
537 |
# dust3r will write the 3D model inside tmpdirname
|
538 |
# with tempfile.TemporaryDirectory(suffix='dust3r_gradio_demo') as tmpdirname:
|
539 |
tmpdirname = os.path.join('logs/user_object')
|
@@ -544,11 +543,6 @@ os.makedirs(tmpdirname, exist_ok=True)
|
|
544 |
if not silent:
|
545 |
print('Outputing stuff in', tmpdirname)
|
546 |
|
547 |
-
# recon_fun = functools.partial(get_reconstructed_scene, tmpdirname, model, device, silent, image_size)
|
548 |
-
# model_from_scene_fun = functools.partial(get_3D_model_from_scene, tmpdirname, silent)
|
549 |
-
|
550 |
-
# generate_mvs = functools.partial(run_eschernet, tmpdirname)
|
551 |
-
|
552 |
_HEADER_ = '''
|
553 |
<h2><b>[CVPR'24 Oral] EscherNet: A Generative Model for Scalable View Synthesis</b></h2>
|
554 |
<b>EscherNet</b> is a multiview diffusion model for scalable generative any-to-any number/pose novel view synthesis.
|
@@ -604,10 +598,6 @@ with gr.Blocks() as demo:
|
|
604 |
# input examples under "examples" folder
|
605 |
gr.Examples(
|
606 |
examples=get_examples('examples'),
|
607 |
-
# examples=[
|
608 |
-
# [['examples/controller/frame000077.jpg', 'examples/controller/frame000032.jpg', 'examples/controller/frame000172.jpg']],
|
609 |
-
# [['examples/hairdryer/frame000081.jpg', 'examples/hairdryer/frame000162.jpg', 'examples/hairdryer/frame000003.jpg']],
|
610 |
-
# ],
|
611 |
inputs=[input_image],
|
612 |
label="Examples (click one set of images to start!)",
|
613 |
examples_per_page=20
|
@@ -664,12 +654,6 @@ with gr.Blocks() as demo:
|
|
664 |
submit = gr.Button("Submit", elem_id="eschernet", variant="primary")
|
665 |
|
666 |
with gr.Row():
|
667 |
-
# mv_show_images = gr.Image(
|
668 |
-
# label="Generated Multi-views",
|
669 |
-
# type="pil",
|
670 |
-
# width=379,
|
671 |
-
# interactive=False
|
672 |
-
# )
|
673 |
with gr.Column():
|
674 |
output_video = gr.Video(
|
675 |
label="video", format="mp4",
|
@@ -678,22 +662,6 @@ with gr.Blocks() as demo:
|
|
678 |
interactive=False
|
679 |
)
|
680 |
|
681 |
-
# with gr.Row():
|
682 |
-
# with gr.Tab("OBJ"):
|
683 |
-
# output_model_obj = gr.Model3D(
|
684 |
-
# label="Output Model (OBJ Format)",
|
685 |
-
# #width=768,
|
686 |
-
# interactive=False,
|
687 |
-
# )
|
688 |
-
# gr.Markdown("Note: Downloaded .obj model will be flipped. Export .glb instead or manually flip it before usage.")
|
689 |
-
# with gr.Tab("GLB"):
|
690 |
-
# output_model_glb = gr.Model3D(
|
691 |
-
# label="Output Model (GLB Format)",
|
692 |
-
# #width=768,
|
693 |
-
# interactive=False,
|
694 |
-
# )
|
695 |
-
# gr.Markdown("Note: The model shown here has a darker appearance. Download to get correct results.")
|
696 |
-
|
697 |
with gr.Row():
|
698 |
gr.Markdown('''The novel views are generated on an archimedean spiral. You can download the video''')
|
699 |
|
|
|
107 |
|
108 |
pipeline.set_progress_bar_config(disable=False)
|
109 |
|
110 |
+
pipeline = pipeline.to(device)
|
111 |
+
|
112 |
# pipeline.enable_xformers_memory_efficient_attention()
|
113 |
# enable vae slicing
|
114 |
pipeline.enable_vae_slicing()
|
115 |
+
pipeline.enable_xformers_memory_efficient_attention()
|
116 |
|
117 |
|
118 |
|
|
|
182 |
assert T_out == pose_out.shape[1]
|
183 |
|
184 |
# run inference
|
185 |
+
# pipeline.to(device)
|
186 |
+
# pipeline.enable_xformers_memory_efficient_attention()
|
187 |
if CaPE_TYPE == "6DoF":
|
188 |
with torch.autocast("cuda"):
|
189 |
image = pipeline(input_imgs=input_image, prompt_imgs=input_image,
|
|
|
336 |
"""
|
337 |
silent = False
|
338 |
image_size = 224
|
|
|
|
|
339 |
# remove the directory if it already exists
|
340 |
outdir = tmpdirname
|
341 |
if os.path.exists(outdir):
|
|
|
531 |
# dustr init
|
532 |
silent = False
|
533 |
image_size = 224
|
534 |
+
weights_path = 'checkpoints/DUSt3R_ViTLarge_BaseDecoder_224_linear.pth'
|
535 |
+
model = AsymmetricCroCo3DStereo.from_pretrained(weights_path).to(device)
|
|
|
536 |
# dust3r will write the 3D model inside tmpdirname
|
537 |
# with tempfile.TemporaryDirectory(suffix='dust3r_gradio_demo') as tmpdirname:
|
538 |
tmpdirname = os.path.join('logs/user_object')
|
|
|
543 |
if not silent:
|
544 |
print('Outputing stuff in', tmpdirname)
|
545 |
|
|
|
|
|
|
|
|
|
|
|
546 |
_HEADER_ = '''
|
547 |
<h2><b>[CVPR'24 Oral] EscherNet: A Generative Model for Scalable View Synthesis</b></h2>
|
548 |
<b>EscherNet</b> is a multiview diffusion model for scalable generative any-to-any number/pose novel view synthesis.
|
|
|
598 |
# input examples under "examples" folder
|
599 |
gr.Examples(
|
600 |
examples=get_examples('examples'),
|
|
|
|
|
|
|
|
|
601 |
inputs=[input_image],
|
602 |
label="Examples (click one set of images to start!)",
|
603 |
examples_per_page=20
|
|
|
654 |
submit = gr.Button("Submit", elem_id="eschernet", variant="primary")
|
655 |
|
656 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
657 |
with gr.Column():
|
658 |
output_video = gr.Video(
|
659 |
label="video", format="mp4",
|
|
|
662 |
interactive=False
|
663 |
)
|
664 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
with gr.Row():
|
666 |
gr.Markdown('''The novel views are generated on an archimedean spiral. You can download the video''')
|
667 |
|