mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-24 09:22:32 +08:00
Merge upstream/master, keep local README.md
This commit is contained in:
commit
b52f3e7b44
@ -1542,6 +1542,10 @@ def soft_empty_cache(force=False):
|
|||||||
def unload_all_models():
|
def unload_all_models():
|
||||||
free_memory(1e30, get_torch_device())
|
free_memory(1e30, get_torch_device())
|
||||||
|
|
||||||
|
def debug_memory_summary():
|
||||||
|
if is_amd() or is_nvidia():
|
||||||
|
return torch.cuda.memory.memory_summary()
|
||||||
|
return ""
|
||||||
|
|
||||||
#TODO: might be cleaner to put this somewhere else
|
#TODO: might be cleaner to put this somewhere else
|
||||||
import threading
|
import threading
|
||||||
|
|||||||
@ -807,6 +807,7 @@ class OmniProTextToVideoNode(IO.ComfyNode):
|
|||||||
),
|
),
|
||||||
IO.Combo.Input("aspect_ratio", options=["16:9", "9:16", "1:1"]),
|
IO.Combo.Input("aspect_ratio", options=["16:9", "9:16", "1:1"]),
|
||||||
IO.Combo.Input("duration", options=[5, 10]),
|
IO.Combo.Input("duration", options=[5, 10]),
|
||||||
|
IO.Combo.Input("resolution", options=["1080p", "720p"], optional=True),
|
||||||
],
|
],
|
||||||
outputs=[
|
outputs=[
|
||||||
IO.Video.Output(),
|
IO.Video.Output(),
|
||||||
@ -826,6 +827,7 @@ class OmniProTextToVideoNode(IO.ComfyNode):
|
|||||||
prompt: str,
|
prompt: str,
|
||||||
aspect_ratio: str,
|
aspect_ratio: str,
|
||||||
duration: int,
|
duration: int,
|
||||||
|
resolution: str = "1080p",
|
||||||
) -> IO.NodeOutput:
|
) -> IO.NodeOutput:
|
||||||
validate_string(prompt, min_length=1, max_length=2500)
|
validate_string(prompt, min_length=1, max_length=2500)
|
||||||
response = await sync_op(
|
response = await sync_op(
|
||||||
@ -837,6 +839,7 @@ class OmniProTextToVideoNode(IO.ComfyNode):
|
|||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
aspect_ratio=aspect_ratio,
|
aspect_ratio=aspect_ratio,
|
||||||
duration=str(duration),
|
duration=str(duration),
|
||||||
|
mode="pro" if resolution == "1080p" else "std",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return await finish_omni_video_task(cls, response)
|
return await finish_omni_video_task(cls, response)
|
||||||
@ -872,6 +875,7 @@ class OmniProFirstLastFrameNode(IO.ComfyNode):
|
|||||||
optional=True,
|
optional=True,
|
||||||
tooltip="Up to 6 additional reference images.",
|
tooltip="Up to 6 additional reference images.",
|
||||||
),
|
),
|
||||||
|
IO.Combo.Input("resolution", options=["1080p", "720p"], optional=True),
|
||||||
],
|
],
|
||||||
outputs=[
|
outputs=[
|
||||||
IO.Video.Output(),
|
IO.Video.Output(),
|
||||||
@ -893,6 +897,7 @@ class OmniProFirstLastFrameNode(IO.ComfyNode):
|
|||||||
first_frame: Input.Image,
|
first_frame: Input.Image,
|
||||||
end_frame: Input.Image | None = None,
|
end_frame: Input.Image | None = None,
|
||||||
reference_images: Input.Image | None = None,
|
reference_images: Input.Image | None = None,
|
||||||
|
resolution: str = "1080p",
|
||||||
) -> IO.NodeOutput:
|
) -> IO.NodeOutput:
|
||||||
prompt = normalize_omni_prompt_references(prompt)
|
prompt = normalize_omni_prompt_references(prompt)
|
||||||
validate_string(prompt, min_length=1, max_length=2500)
|
validate_string(prompt, min_length=1, max_length=2500)
|
||||||
@ -936,6 +941,7 @@ class OmniProFirstLastFrameNode(IO.ComfyNode):
|
|||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
duration=str(duration),
|
duration=str(duration),
|
||||||
image_list=image_list,
|
image_list=image_list,
|
||||||
|
mode="pro" if resolution == "1080p" else "std",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return await finish_omni_video_task(cls, response)
|
return await finish_omni_video_task(cls, response)
|
||||||
@ -964,6 +970,7 @@ class OmniProImageToVideoNode(IO.ComfyNode):
|
|||||||
"reference_images",
|
"reference_images",
|
||||||
tooltip="Up to 7 reference images.",
|
tooltip="Up to 7 reference images.",
|
||||||
),
|
),
|
||||||
|
IO.Combo.Input("resolution", options=["1080p", "720p"], optional=True),
|
||||||
],
|
],
|
||||||
outputs=[
|
outputs=[
|
||||||
IO.Video.Output(),
|
IO.Video.Output(),
|
||||||
@ -984,6 +991,7 @@ class OmniProImageToVideoNode(IO.ComfyNode):
|
|||||||
aspect_ratio: str,
|
aspect_ratio: str,
|
||||||
duration: int,
|
duration: int,
|
||||||
reference_images: Input.Image,
|
reference_images: Input.Image,
|
||||||
|
resolution: str = "1080p",
|
||||||
) -> IO.NodeOutput:
|
) -> IO.NodeOutput:
|
||||||
prompt = normalize_omni_prompt_references(prompt)
|
prompt = normalize_omni_prompt_references(prompt)
|
||||||
validate_string(prompt, min_length=1, max_length=2500)
|
validate_string(prompt, min_length=1, max_length=2500)
|
||||||
@ -1005,6 +1013,7 @@ class OmniProImageToVideoNode(IO.ComfyNode):
|
|||||||
aspect_ratio=aspect_ratio,
|
aspect_ratio=aspect_ratio,
|
||||||
duration=str(duration),
|
duration=str(duration),
|
||||||
image_list=image_list,
|
image_list=image_list,
|
||||||
|
mode="pro" if resolution == "1080p" else "std",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return await finish_omni_video_task(cls, response)
|
return await finish_omni_video_task(cls, response)
|
||||||
@ -1036,6 +1045,7 @@ class OmniProVideoToVideoNode(IO.ComfyNode):
|
|||||||
tooltip="Up to 4 additional reference images.",
|
tooltip="Up to 4 additional reference images.",
|
||||||
optional=True,
|
optional=True,
|
||||||
),
|
),
|
||||||
|
IO.Combo.Input("resolution", options=["1080p", "720p"], optional=True),
|
||||||
],
|
],
|
||||||
outputs=[
|
outputs=[
|
||||||
IO.Video.Output(),
|
IO.Video.Output(),
|
||||||
@ -1058,6 +1068,7 @@ class OmniProVideoToVideoNode(IO.ComfyNode):
|
|||||||
reference_video: Input.Video,
|
reference_video: Input.Video,
|
||||||
keep_original_sound: bool,
|
keep_original_sound: bool,
|
||||||
reference_images: Input.Image | None = None,
|
reference_images: Input.Image | None = None,
|
||||||
|
resolution: str = "1080p",
|
||||||
) -> IO.NodeOutput:
|
) -> IO.NodeOutput:
|
||||||
prompt = normalize_omni_prompt_references(prompt)
|
prompt = normalize_omni_prompt_references(prompt)
|
||||||
validate_string(prompt, min_length=1, max_length=2500)
|
validate_string(prompt, min_length=1, max_length=2500)
|
||||||
@ -1090,6 +1101,7 @@ class OmniProVideoToVideoNode(IO.ComfyNode):
|
|||||||
duration=str(duration),
|
duration=str(duration),
|
||||||
image_list=image_list if image_list else None,
|
image_list=image_list if image_list else None,
|
||||||
video_list=video_list,
|
video_list=video_list,
|
||||||
|
mode="pro" if resolution == "1080p" else "std",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return await finish_omni_video_task(cls, response)
|
return await finish_omni_video_task(cls, response)
|
||||||
@ -1119,6 +1131,7 @@ class OmniProEditVideoNode(IO.ComfyNode):
|
|||||||
tooltip="Up to 4 additional reference images.",
|
tooltip="Up to 4 additional reference images.",
|
||||||
optional=True,
|
optional=True,
|
||||||
),
|
),
|
||||||
|
IO.Combo.Input("resolution", options=["1080p", "720p"], optional=True),
|
||||||
],
|
],
|
||||||
outputs=[
|
outputs=[
|
||||||
IO.Video.Output(),
|
IO.Video.Output(),
|
||||||
@ -1139,6 +1152,7 @@ class OmniProEditVideoNode(IO.ComfyNode):
|
|||||||
video: Input.Video,
|
video: Input.Video,
|
||||||
keep_original_sound: bool,
|
keep_original_sound: bool,
|
||||||
reference_images: Input.Image | None = None,
|
reference_images: Input.Image | None = None,
|
||||||
|
resolution: str = "1080p",
|
||||||
) -> IO.NodeOutput:
|
) -> IO.NodeOutput:
|
||||||
prompt = normalize_omni_prompt_references(prompt)
|
prompt = normalize_omni_prompt_references(prompt)
|
||||||
validate_string(prompt, min_length=1, max_length=2500)
|
validate_string(prompt, min_length=1, max_length=2500)
|
||||||
@ -1171,6 +1185,7 @@ class OmniProEditVideoNode(IO.ComfyNode):
|
|||||||
duration=None,
|
duration=None,
|
||||||
image_list=image_list if image_list else None,
|
image_list=image_list if image_list else None,
|
||||||
video_list=video_list,
|
video_list=video_list,
|
||||||
|
mode="pro" if resolution == "1080p" else "std",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return await finish_omni_video_task(cls, response)
|
return await finish_omni_video_task(cls, response)
|
||||||
|
|||||||
@ -78,18 +78,20 @@ class ImageUpscaleWithModel(io.ComfyNode):
|
|||||||
overlap = 32
|
overlap = 32
|
||||||
|
|
||||||
oom = True
|
oom = True
|
||||||
while oom:
|
try:
|
||||||
try:
|
while oom:
|
||||||
steps = in_img.shape[0] * comfy.utils.get_tiled_scale_steps(in_img.shape[3], in_img.shape[2], tile_x=tile, tile_y=tile, overlap=overlap)
|
try:
|
||||||
pbar = comfy.utils.ProgressBar(steps)
|
steps = in_img.shape[0] * comfy.utils.get_tiled_scale_steps(in_img.shape[3], in_img.shape[2], tile_x=tile, tile_y=tile, overlap=overlap)
|
||||||
s = comfy.utils.tiled_scale(in_img, lambda a: upscale_model(a), tile_x=tile, tile_y=tile, overlap=overlap, upscale_amount=upscale_model.scale, pbar=pbar)
|
pbar = comfy.utils.ProgressBar(steps)
|
||||||
oom = False
|
s = comfy.utils.tiled_scale(in_img, lambda a: upscale_model(a), tile_x=tile, tile_y=tile, overlap=overlap, upscale_amount=upscale_model.scale, pbar=pbar)
|
||||||
except model_management.OOM_EXCEPTION as e:
|
oom = False
|
||||||
tile //= 2
|
except model_management.OOM_EXCEPTION as e:
|
||||||
if tile < 128:
|
tile //= 2
|
||||||
raise e
|
if tile < 128:
|
||||||
|
raise e
|
||||||
|
finally:
|
||||||
|
upscale_model.to("cpu")
|
||||||
|
|
||||||
upscale_model.to("cpu")
|
|
||||||
s = torch.clamp(s.movedim(-3,-1), min=0, max=1.0)
|
s = torch.clamp(s.movedim(-3,-1), min=0, max=1.0)
|
||||||
return io.NodeOutput(s)
|
return io.NodeOutput(s)
|
||||||
|
|
||||||
|
|||||||
@ -601,6 +601,7 @@ async def execute(server, dynprompt, caches, current_item, extra_data, executed,
|
|||||||
|
|
||||||
if isinstance(ex, comfy.model_management.OOM_EXCEPTION):
|
if isinstance(ex, comfy.model_management.OOM_EXCEPTION):
|
||||||
tips = "This error means you ran out of memory on your GPU.\n\nTIPS: If the workflow worked before you might have accidentally set the batch_size to a large number."
|
tips = "This error means you ran out of memory on your GPU.\n\nTIPS: If the workflow worked before you might have accidentally set the batch_size to a large number."
|
||||||
|
logging.info("Memory summary: {}".format(comfy.model_management.debug_memory_summary()))
|
||||||
logging.error("Got an OOM, unloading all loaded models.")
|
logging.error("Got an OOM, unloading all loaded models.")
|
||||||
comfy.model_management.unload_all_models()
|
comfy.model_management.unload_all_models()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user