mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-06-19 14:29:33 +08:00
Compare commits
11 Commits
6e55f329d8
...
aa3f33962f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa3f33962f | ||
|
|
72e3f6081c | ||
|
|
7ec7b6ffe9 | ||
|
|
6887165a9d | ||
|
|
cc4d711eb1 | ||
|
|
626b082838 | ||
|
|
d0328b442d | ||
|
|
743599bd18 | ||
|
|
382c20809b | ||
|
|
27f40af5f5 | ||
|
|
25d4954b10 |
@ -260,7 +260,7 @@ def resolve_cast_module_with_vbar(s, dtype, device, bias_dtype, compute_dtype, w
|
||||
|
||||
|
||||
def cast_bias_weight(s, input=None, dtype=None, device=None, bias_dtype=None, offloadable=False, compute_dtype=None, want_requant=False):
|
||||
# NOTE: offloadable=False is a a legacy and if you are a custom node author reading this please pass
|
||||
# NOTE: offloadable=False is a legacy mode and if you are a custom node author reading this please pass
|
||||
# offloadable=True and call uncast_bias_weight() after your last usage of the weight/bias. This
|
||||
# will add async-offload support to your cast and improve performance.
|
||||
if input is not None:
|
||||
|
||||
@ -77,7 +77,7 @@ class EmptyLTXVLatentVideo(io.ComfyNode):
|
||||
@classmethod
|
||||
def execute(cls, width, height, length, batch_size=1) -> io.NodeOutput:
|
||||
latent = torch.zeros([batch_size, 128, ((length - 1) // 8) + 1, height // 32, width // 32], device=comfy.model_management.intermediate_device())
|
||||
return io.NodeOutput({"samples": latent})
|
||||
return io.NodeOutput({"samples": latent, "downscale_ratio_spacial": 32})
|
||||
|
||||
generate = execute # TODO: remove
|
||||
|
||||
|
||||
@ -1,10 +1,41 @@
|
||||
import re
|
||||
import json
|
||||
import string
|
||||
from typing_extensions import override
|
||||
|
||||
from comfy_api.latest import ComfyExtension, io
|
||||
|
||||
|
||||
class StringFormat(io.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls) -> io.Schema:
|
||||
autogrow = io.Autogrow.TemplateNames(
|
||||
input=io.AnyType.Input("value"),
|
||||
names=list(string.ascii_lowercase),
|
||||
min=0,
|
||||
)
|
||||
return io.Schema(
|
||||
node_id="StringFormat",
|
||||
display_name="Format Text",
|
||||
category="text",
|
||||
search_aliases=["string", "format"],
|
||||
description="Same as Python's string format method. Supports all of Python's format options and features.",
|
||||
inputs=[
|
||||
io.Autogrow.Input("values", template=autogrow),
|
||||
io.String.Input("f_string", default="{a}", multiline=True),
|
||||
],
|
||||
outputs=[
|
||||
io.String.Output(),
|
||||
],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(
|
||||
cls, values: io.Autogrow.Type, f_string: str
|
||||
) -> io.NodeOutput:
|
||||
return io.NodeOutput(f_string.format(**values))
|
||||
|
||||
|
||||
class StringConcatenate(io.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
@ -413,6 +444,7 @@ class StringExtension(ComfyExtension):
|
||||
@override
|
||||
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||
return [
|
||||
StringFormat,
|
||||
StringConcatenate,
|
||||
StringSubstring,
|
||||
StringLength,
|
||||
|
||||
34
nodes.py
34
nodes.py
@ -1684,20 +1684,46 @@ class PreviewImage(SaveImage):
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||
}
|
||||
|
||||
|
||||
class LoadImage:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
input_dir = folder_paths.get_input_directory()
|
||||
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
|
||||
files = folder_paths.filter_files_content_types(files, ["image"])
|
||||
files = []
|
||||
limit = 1000
|
||||
recursive_scan_failed = False
|
||||
|
||||
# Attempt recursive scan first
|
||||
try:
|
||||
for root, _, file_list in os.walk(input_dir, followlinks=False):
|
||||
if recursive_scan_failed:
|
||||
break
|
||||
|
||||
image_files = folder_paths.filter_files_content_types(file_list, ["image"])
|
||||
|
||||
for image_file in image_files:
|
||||
if len(files) >= limit:
|
||||
recursive_scan_failed = True
|
||||
break
|
||||
|
||||
path_relative = os.path.relpath(os.path.join(root, image_file), input_dir)
|
||||
path_relative = path_relative.replace('\\', '/')
|
||||
files.append(path_relative)
|
||||
except Exception:
|
||||
recursive_scan_failed = True
|
||||
|
||||
# Fallback to original non-recursive method if limit exceeded or error
|
||||
if recursive_scan_failed or not files:
|
||||
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
|
||||
files = folder_paths.filter_files_content_types(files, ["image"])
|
||||
|
||||
return {"required":
|
||||
{"image": (sorted(files), {"image_upload": True})},
|
||||
{"image": (sorted(list(dict.fromkeys(files))), {"image_upload": True})},
|
||||
}
|
||||
|
||||
CATEGORY = "image"
|
||||
ESSENTIALS_CATEGORY = "Basics"
|
||||
SEARCH_ALIASES = ["load image", "open image", "import image", "image input", "upload image", "read image", "image loader"]
|
||||
|
||||
RETURN_TYPES = ("IMAGE", "MASK")
|
||||
FUNCTION = "load_image"
|
||||
|
||||
|
||||
22
openapi.yaml
22
openapi.yaml
@ -4160,6 +4160,10 @@ paths:
|
||||
name:
|
||||
type: string
|
||||
description: Display name for the API key
|
||||
description:
|
||||
type: string
|
||||
description: User-provided description of the key's purpose
|
||||
maxLength: 5000
|
||||
responses:
|
||||
"201":
|
||||
description: API key created
|
||||
@ -6351,14 +6355,6 @@ components:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Size of the asset in bytes
|
||||
width:
|
||||
type: integer
|
||||
nullable: true
|
||||
description: "Original image width in pixels. Null for non-image assets or assets ingested before dimension extraction."
|
||||
height:
|
||||
type: integer
|
||||
nullable: true
|
||||
description: "Original image height in pixels. Null for non-image assets or assets ingested before dimension extraction."
|
||||
mime_type:
|
||||
type: string
|
||||
description: MIME type of the asset
|
||||
@ -7685,11 +7681,16 @@ components:
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
- description
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
maxLength: 5000
|
||||
description: User-provided description of the key's purpose. Always present in responses; empty string when no description was supplied on create.
|
||||
prefix:
|
||||
type: string
|
||||
description: First few characters of the key for identification
|
||||
@ -7710,12 +7711,17 @@ components:
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
- description
|
||||
- key
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
maxLength: 5000
|
||||
description: User-provided description of the key's purpose. Always present in responses; empty string when no description was supplied on create.
|
||||
key:
|
||||
type: string
|
||||
description: Full API key value (only returned on creation)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user