Browse Source

Update __init__.py

pull/68/head
tin2tin 1 year ago committed by GitHub
parent
commit
055325e241
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      __init__.py

36
__init__.py

@ -1402,8 +1402,6 @@ class SEQUENCER_PT_pallaidium_panel(Panel): # UI
col.prop(context.scene, "blip_tgt_subject", text="Target Subject") col.prop(context.scene, "blip_tgt_subject", text="Target Subject")
else: else:
col.prop(context.scene, "input_strips", text="Input") col.prop(context.scene, "input_strips", text="Input")
if type != "audio": if type != "audio":
if type == "movie" or ( if type == "movie" or (
@ -1488,9 +1486,18 @@ class SEQUENCER_PT_pallaidium_panel(Panel): # UI
col = col.box() col = col.box()
col.prop(context.scene, "generatorai_typeselect", text="Output") col.prop(context.scene, "generatorai_typeselect", text="Output")
col = col.column(heading="Free Lunch", align=True) if type != "audio":
col.prop(context.scene, "use_free_lunch", text=" (Experimental)") if type == "movie" or (
type == "image"
and image_model_card != "lllyasviel/sd-controlnet-canny"
and image_model_card != "lllyasviel/sd-controlnet-openpose"
and image_model_card != "lllyasviel/control_v11p_sd15_scribble"
and image_model_card != "monster-labs/control_v1p_sd15_qrcode_monster"
and image_model_card != "Salesforce/blipdiffusion"
):
col = col.column(heading="Free Lunch", align=True)
col.prop(context.scene, "use_free_lunch", text=" (Experimental)")
if type == "movie" and ( if type == "movie" and (
movie_model_card == "cerspense/zeroscope_v2_dark_30x448x256" movie_model_card == "cerspense/zeroscope_v2_dark_30x448x256"
@ -1596,6 +1603,7 @@ class SEQUENCER_OT_generate_movie(Operator):
addon_prefs = preferences.addons[__name__].preferences addon_prefs = preferences.addons[__name__].preferences
movie_model_card = addon_prefs.movie_model_card movie_model_card = addon_prefs.movie_model_card
image_model_card = addon_prefs.image_model_card image_model_card = addon_prefs.image_model_card
pipe = None
if torch.cuda.is_available(): if torch.cuda.is_available():
torch.cuda.empty_cache() torch.cuda.empty_cache()
@ -1745,6 +1753,7 @@ class SEQUENCER_OT_generate_movie(Operator):
if scene.use_free_lunch and pipe: #Free Lunch if scene.use_free_lunch and pipe: #Free Lunch
# -------- freeu block registration # -------- freeu block registration
print("Having a free lunch...")
register_free_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4) register_free_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4)
register_free_crossattn_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4) register_free_crossattn_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4)
# -------- freeu block registration # -------- freeu block registration
@ -1789,6 +1798,7 @@ class SEQUENCER_OT_generate_movie(Operator):
generator.manual_seed(seed) generator.manual_seed(seed)
else: else:
generator = None generator = None
# Process batch input # Process batch input
if (scene.movie_path or scene.image_path) and input == "input_strips": if (scene.movie_path or scene.image_path) and input == "input_strips":
video_path = scene.movie_path video_path = scene.movie_path
@ -1902,6 +1912,7 @@ class SEQUENCER_OT_generate_movie(Operator):
# Movie. # Movie.
else: else:
print("Generate: Video") print("Generate: Video")
video_frames = pipe( video_frames = pipe(
prompt, prompt,
negative_prompt=negative_prompt, negative_prompt=negative_prompt,
@ -1917,6 +1928,7 @@ class SEQUENCER_OT_generate_movie(Operator):
if torch.cuda.is_available(): if torch.cuda.is_available():
torch.cuda.empty_cache() torch.cuda.empty_cache()
# Upscale video. # Upscale video.
if scene.video_to_video: if scene.video_to_video:
print("Upscale: Video") print("Upscale: Video")
@ -1938,6 +1950,7 @@ class SEQUENCER_OT_generate_movie(Operator):
guidance_scale=movie_num_guidance, guidance_scale=movie_num_guidance,
generator=generator, generator=generator,
).frames ).frames
# Move to folder. # Move to folder.
src_path = export_to_video(video_frames) src_path = export_to_video(video_frames)
dst_path = solve_path(clean_filename(str(seed) + "_" + prompt) + ".mp4") dst_path = solve_path(clean_filename(str(seed) + "_" + prompt) + ".mp4")
@ -2628,6 +2641,13 @@ class SEQUENCER_OT_generate_image(Operator):
else: else:
pipe.to("cuda") pipe.to("cuda")
if scene.use_free_lunch and pipe: #Free Lunch
# -------- freeu block registration
print("Having a free lunch...")
register_free_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4)
register_free_crossattn_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4)
# -------- freeu block registration
# load refiner model if chosen. # load refiner model if chosen.
if do_refine: if do_refine:
print( print(
@ -2653,12 +2673,6 @@ class SEQUENCER_OT_generate_image(Operator):
# else: # else:
# refiner.to("cuda") # refiner.to("cuda")
if scene.use_free_lunch and pipe: #Free Lunch
# -------- freeu block registration
register_free_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4)
register_free_crossattn_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4)
# -------- freeu block registration
# Main Generate Loop: # Main Generate Loop:
for i in range(scene.movie_num_batch): for i in range(scene.movie_num_batch):
# Find free space for the strip in the timeline. # Find free space for the strip in the timeline.

Loading…
Cancel
Save