Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc62d2be03 | ||
|
|
74beb22df4 | ||
|
|
0d43174e14 | ||
|
|
91336e987d | ||
|
|
cbf771ff03 | ||
|
|
867f5eb6f1 | ||
|
|
88ed9fa966 |
@@ -1,4 +1,16 @@
|
||||
# Change Log
|
||||
## v1.3.1
|
||||
> Starting from v1.3, to support auto-detection on Civitai, `calculate_model_hash` will be renamed as
|
||||
> `calculate_hash` and it will be enabled by default. Due to the addition of temporary storage of the model hash values,
|
||||
> the first image generated after switching to the new model will take more time to calculate the hash value,
|
||||
> but it will not affect the generation speed afterwards until the server is restarted.
|
||||
|
||||
- Add user-friendly warnings and remove the exception raised during the reading of metadata #58 #63
|
||||
- Add JPEG to the image extension list
|
||||
- Fix the issue where the `Prompt Saver` node cannot consume filename from another `Prompt Saver` node #62
|
||||
- Fix the `Prompt Saver` node freezes workflow when name includes `%model` #61
|
||||
- Remove ckpt validation of the `Prompt Reader` node #59
|
||||
|
||||
## v1.3.0
|
||||
> Starting from this version, to support auto-detection on Civitai, `calculate_model_hash` will be renamed as
|
||||
> `calculate_hash` and it will be enabled by default. Due to the addition of temporary storage of the model hash values,
|
||||
|
||||
@@ -132,6 +132,8 @@ the `Prompt Saver` Node and `KSampler` Node.
|
||||
<details>
|
||||
<summary><b>More Information</b></summary>
|
||||
|
||||
#### Image Format
|
||||
- Only PNG format supports embedding both metadata and workflow at the same time. Other formats can only embed metadata.
|
||||
#### Duplicate Filename
|
||||
- When the filename already exists, an index will be added at the end of the filename,
|
||||
e.g. `file.png, file_1.png, file_2.png`.
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
VERSION = "1.3.0"
|
||||
VERSION = "1.3.1"
|
||||
|
||||
@@ -30,7 +30,6 @@ import folder_paths
|
||||
|
||||
from .stable_diffusion_prompt_reader.sd_prompt_reader.constants import (
|
||||
SUPPORTED_FORMATS,
|
||||
MESSAGE,
|
||||
)
|
||||
from .stable_diffusion_prompt_reader.sd_prompt_reader.image_data_reader import (
|
||||
ImageDataReader,
|
||||
@@ -45,6 +44,15 @@ BLUE = "\033[1;34m"
|
||||
CYAN = "\033[36m"
|
||||
RESET = "\033[0m"
|
||||
|
||||
ERROR_MESSAGE = {
|
||||
"format_error": "No data detected or unsupported format. "
|
||||
"Please see the README for more details.\n"
|
||||
"https://github.com/receyuki/comfyui-prompt-reader-node#supported-formats",
|
||||
"complex_workflow": "The workflow is overly complex, or unsupported custom nodes have been used. "
|
||||
"Please see the README for more details.\n"
|
||||
"https://github.com/receyuki/comfyui-prompt-reader-node#prompt-reader-node",
|
||||
}
|
||||
|
||||
|
||||
def output_to_terminal(text: str):
|
||||
print(f"{RESET+BLUE}" f"[SD Prompt Reader] " f"{CYAN+text+RESET}")
|
||||
@@ -148,15 +156,30 @@ class SDPromptReader:
|
||||
|
||||
file_path = Path(image_path)
|
||||
|
||||
if file_path.suffix not in SUPPORTED_FORMATS:
|
||||
output_to_terminal(MESSAGE["suffix_error"][1])
|
||||
raise ValueError(MESSAGE["suffix_error"][1])
|
||||
|
||||
with open(file_path, "rb") as f:
|
||||
image_data = ImageDataReader(f)
|
||||
try:
|
||||
image_data = ImageDataReader(f)
|
||||
except:
|
||||
output_to_terminal(ERROR_MESSAGE["complex_workflow"])
|
||||
return self.error_output(
|
||||
error_message=ERROR_MESSAGE["complex_workflow"],
|
||||
image=image,
|
||||
mask=mask,
|
||||
width=i.width,
|
||||
height=i.height,
|
||||
filename=file_path.stem,
|
||||
)
|
||||
|
||||
if not image_data.tool:
|
||||
output_to_terminal(MESSAGE["format_error"][1])
|
||||
raise ValueError(MESSAGE["format_error"][1])
|
||||
output_to_terminal(ERROR_MESSAGE["format_error"])
|
||||
return self.error_output(
|
||||
error_message=ERROR_MESSAGE["format_error"],
|
||||
image=image,
|
||||
mask=mask,
|
||||
width=i.width,
|
||||
height=i.height,
|
||||
filename=file_path.stem,
|
||||
)
|
||||
|
||||
seed = int(
|
||||
self.param_parser(image_data.parameter.get("seed", 0), parameter_index)
|
||||
@@ -235,6 +258,28 @@ class SDPromptReader:
|
||||
|
||||
return model
|
||||
|
||||
@staticmethod
|
||||
def error_output(
|
||||
error_message, image=None, mask=None, width=0, height=0, filename=""
|
||||
):
|
||||
return {
|
||||
"ui": {"text": ("", "", error_message)},
|
||||
"result": (
|
||||
image,
|
||||
mask,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
0,
|
||||
0.0,
|
||||
width,
|
||||
height,
|
||||
"",
|
||||
filename,
|
||||
"",
|
||||
),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(s, image, parameter_index):
|
||||
if image in SDPromptReader.files:
|
||||
@@ -316,7 +361,7 @@ class SDPromptSaver:
|
||||
),
|
||||
"positive": ("STRING", {"default": "", "multiline": True}),
|
||||
"negative": ("STRING", {"default": "", "multiline": True}),
|
||||
"extension": (["png", "jpg", "webp"],),
|
||||
"extension": (["png", "jpg", "jpeg", "webp"],),
|
||||
"calculate_hash": ("BOOLEAN", {"default": True}),
|
||||
"resource_hash": ("BOOLEAN", {"default": True}),
|
||||
"lossless_webp": ("BOOLEAN", {"default": True}),
|
||||
@@ -408,7 +453,7 @@ class SDPromptSaver:
|
||||
"%steps": steps,
|
||||
"%cfg": cfg,
|
||||
"%extension": extension,
|
||||
"%model": model_name_real,
|
||||
"%model": Path(model_name_real).stem,
|
||||
"%sampler": sampler_name_real,
|
||||
"%scheduler": scheduler_real,
|
||||
"%quality": jpg_webp_quality,
|
||||
@@ -552,7 +597,14 @@ class SDPromptSaver:
|
||||
output_to_terminal("Saved file: " + str(file))
|
||||
comments.append(comment)
|
||||
|
||||
return {"ui": {"images": results}, "result": (files, file_paths, comments)}
|
||||
return {
|
||||
"ui": {"images": results},
|
||||
"result": (
|
||||
self.unpack_singleton(files),
|
||||
self.unpack_singleton(file_paths),
|
||||
self.unpack_singleton(comments),
|
||||
),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def calculate_hash(name, hash_type):
|
||||
@@ -634,6 +686,10 @@ class SDPromptSaver:
|
||||
|
||||
return ""
|
||||
|
||||
@staticmethod
|
||||
def unpack_singleton(arr: list):
|
||||
return arr[0] if len(arr) == 1 else arr
|
||||
|
||||
|
||||
class SDParameterGenerator:
|
||||
ASPECT_RATIO_MAP = {
|
||||
@@ -807,9 +863,6 @@ class SDParameterGenerator:
|
||||
output_vae=True,
|
||||
output_clip=True,
|
||||
):
|
||||
if ckpt_name not in SDParameterGenerator.ckpt_list:
|
||||
raise FileNotFoundError(f"Invalid ckpt_name: {ckpt_name}")
|
||||
|
||||
ckpt_path = folder_paths.get_full_path("checkpoints", ckpt_name)
|
||||
if config_name != "none":
|
||||
config_path = folder_paths.get_full_path("configs", config_name)
|
||||
|
||||
Reference in New Issue
Block a user