Krea2 - Full Qwen LLM Support Node
Comfy UI Node
Supports Image to Text without additional steps
Fixed seed support for the LLM for faster inference
QWEN VL supports LLM instructions such as describe this image as anime
Text out support allows for automated dataset captioning, optionally you could use this to convert art style of an image.
Description
FAQ
Comments (4)
it seems when I purge cache and memory, the llm doesn't get unloaded, it is the reason why I had to save the cond and then restart the backend to test
Maybe a comfy kitchen issue?
[INFO] [ComfyUI-Manager] All startup tasks have been completed. torch_dtype is deprecated! Use dtype instead! Qwen3-VL ERROR: Traceback (most recent call last): File "D:\SDcomfyUI\ComfyUI\custom_nodes\QWEN_Text_Enhance.py", line 727, in generate ) = run_Qwen( ^^^^^^^^^ File "D:\SDcomfyUI\ComfyUI\custom_nodes\QWEN_Text_Enhance.py", line 518, in run_Qwen krea_inputs = processor.apply_chat_template( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\SDcomfyUI\python_embeded\Lib\site-packages\transformers\utils\deprecation.py", line 172, in wrapped_func return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "D:\SDcomfyUI\python_embeded\Lib\site-packages\transformers\utils\deprecation.py", line 172, in wrapped_func return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "D:\SDcomfyUI\python_embeded\Lib\site-packages\transformers\processing_utils.py", line 1640, in apply_chat_template visuals = [content for content in message["content"] if content["type"] in ["image", "video"]] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\SDcomfyUI\python_embeded\Lib\site-packages\transformers\processing_utils.py", line 1640, in <listcomp> visuals = [content for content in message["content"] if content["type"] in ["image", "video"]] ~~~~~~~^^^^^^^^ TypeError: string indices must be integers, not 'str'
After the AI modifications, it runs correctly now; here it is for reference:
.....
def build_messages(prompt, images=None):
"""
Creates standard Qwen3-VL chat messages.
"""
messages = [
{
"role": "system",
# Modification: Encapsulate the system content as a list of dictionaries.
"content": [
{
"type": "text",
"text": SYSTEM_PROMPT,
}
],
}
]
....
def run_Qwen(
prompt,
max_tokens,
seed,
image=None,
):
load_model()
images = None
if image is not None:
images = comfy_image_to_pil(image)
# --------------------------------------------------------
# Build the Krea2 prompt WITH the image
# --------------------------------------------------------
krea_prompt = KREA2_TEMPLATE.format(prompt)
if images:
# Build messages with image for Krea conditioning
krea_messages = [
{
"role": "system",
# Modification: The content of the system role must also be in the format [{"type": "text", "text": ...}].
"content": [
{
"type": "text",
"text": "Describe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:",
}
],
},
{
"role": "user",
"content": [
{"type": "image", "image": images[0]},
{"type": "text", "text": prompt},
],
},
# Change: Removed the assistant placeholder that was causing errors.
]
krea_inputs = processor.apply_chat_template(
krea_messages,
tokenize=True,
add_generation_prompt=True, # Modification: Set to True to automatically concatenate unclosed assistant prefixes.
return_dict=True,
return_tensors="pt",
)
else:
# Text-only fallback
krea_inputs = processor(
text=krea_prompt,
return_tensors="pt",
)
....




