ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

workflow wanted for qwen image layered

Open manassm opened this issue 1 week ago • 46 comments

https://huggingface.co/Qwen/Qwen-Image-Layered

I was wondering if there is example workflow for qwen image layered. Thank you for your consideration.

manassm avatar Dec 19 '25 20:12 manassm

Image

Try this one.

comfyanonymous avatar Dec 19 '25 21:12 comfyanonymous

where can i find qwen_image_edit_layered.safetensors?

manassm avatar Dec 20 '25 02:12 manassm

too slow ,using gguf, 12g vram is overflowed

Image

zwukong avatar Dec 20 '25 02:12 zwukong

Files can be found here: https://huggingface.co/Comfy-Org/Qwen-Image-Layered_ComfyUI/tree/main/split_files

Yes this model is slow.

comfyanonymous avatar Dec 20 '25 03:12 comfyanonymous

i think it is not a good idea to get all the layers, tell an edit model to get the elements we want is the future .What we need is just the pic with alpha channel, that is why it is revolutionary

zwukong avatar Dec 20 '25 03:12 zwukong

i think it is not a good idea to get all the layers, tell an edit model to get the elements we want is the future

I think it will be a little difficult to run at the same time, because the memory requirements are too high. This model runs a bit slowly.

pruidong avatar Dec 20 '25 03:12 pruidong

use gguf , set size to 512 and 2 layers is better, we want nunchaku 😄

zwukong avatar Dec 20 '25 04:12 zwukong

is gguf model out already? where can I find it?

manassm avatar Dec 20 '25 04:12 manassm

https://huggingface.co/QuantStack/Qwen-Image-Layered-GGUF >=Q4 km

zwukong avatar Dec 20 '25 04:12 zwukong

I'm getting error below. I guess it's because I use comfy desktop with delayed support. Guess I'll need to wait for update. (Only if there was way to duel boot desktop and portable with shared model directory I might test it sooner...) Thank you for your help anyways.

Image Image Image

manassm avatar Dec 20 '25 04:12 manassm

Where is workable workflow? They'are supposed to release a sample workflow with the model, aren't they?

myonlang avatar Dec 20 '25 06:12 myonlang

same problem. and there are no missing custom nodes listed.

Image

MoreColors123 avatar Dec 20 '25 10:12 MoreColors123

@myonlang You can find a workflow inside the image comfyanonymous posted above, drag and drop it into comfyui.

@MoreColors123 @manassm The missing node is from the core comfy nodes, you just need to update comfyui

geodesius avatar Dec 20 '25 12:12 geodesius

Making people download this image is bullying ;)

Rotatingxenomorph avatar Dec 20 '25 12:12 Rotatingxenomorph

i think it is not a good idea to get all the layers, tell an edit model to get the elements we want is the future

I think it will be a little difficult to run at the same time, because the memory requirements are too high. This model runs a bit slowly.

I used FAL and cranked it up to 10 images. I can see how it could be useful but it's not 'the secret to nano banana'. Back to waiting for z turbo edit.

Rotatingxenomorph avatar Dec 20 '25 12:12 Rotatingxenomorph

Using layers is a good idea. And it always made sense. The next step for AI artists is when they can use Krea or Photoshop to create each object and its details in the scene individually, including editing hands and other details.

godlatero avatar Dec 20 '25 20:12 godlatero

Where is teh "Latent cut to batch" Node? It's not in Comfy-core

lonecatone23 avatar Dec 20 '25 20:12 lonecatone23

Getting error RuntimeError: mat1 and mat2 shapes cannot be multiplied (77x768 and 3072x768) for the text encode node, any ideas?

Traceback (most recent call last):
  File "ComfyUI/execution.py", line 516, in execute
    output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "ComfyUI/execution.py", line 330, in get_output_data
    return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "ComfyUI/execution.py", line 304, in _async_map_node_over_list
    await process_inputs(input_dict, i)
  File "ComfyUI/execution.py", line 292, in process_inputs
    result = f(**inputs)
  File "ComfyUI/nodes.py", line 77, in encode
    return (clip.encode_from_tokens_scheduled(tokens), )
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "ComfyUI/comfy/sd.py", line 207, in encode_from_tokens_scheduled
    pooled_dict = self.encode_from_tokens(tokens, return_pooled=return_pooled, return_dict=True)
  File "ComfyUI/comfy/sd.py", line 271, in encode_from_tokens
    o = self.cond_stage_model.encode_token_weights(tokens)
  File "ComfyUI/comfy/sd1_clip.py", line 704, in encode_token_weights
    out = getattr(self, self.clip).encode_token_weights(token_weight_pairs)
  File "ComfyUI/comfy/sd1_clip.py", line 45, in encode_token_weights
    o = self.encode(to_encode)
  File "ComfyUI/comfy/sd1_clip.py", line 297, in encode
    return self(tokens)
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
    return forward_call(*args, **kwargs)
  File "ComfyUI/comfy/sd1_clip.py", line 270, in forward
    outputs = self.transformer(None, attention_mask_model, embeds=embeds, num_tokens=num_tokens, intermediate_output=intermediate_output, final_layer_norm_intermediate=self.layer_norm_hidden_state, dtype=torch.float32, embeds_info=embeds_info)
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
    return forward_call(*args, **kwargs)
  File "ComfyUI/comfy/clip_model.py", line 155, in forward
    x = self.text_model(*args, **kwargs)
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
    return forward_call(*args, **kwargs)
  File "ComfyUI/comfy/clip_model.py", line 128, in forward
    x, i = self.encoder(x, mask=mask, intermediate_output=intermediate_output)
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
    return forward_call(*args, **kwargs)
  File "ComfyUI/comfy/clip_model.py", line 74, in forward
    x = l(x, mask, optimized_attention)
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
    return forward_call(*args, **kwargs)
  File "ComfyUI/comfy/clip_model.py", line 52, in forward
    x += self.mlp(self.layer_norm2(x))
         ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
    return forward_call(*args, **kwargs)
  File "ComfyUI/comfy/clip_model.py", line 37, in forward
    x = self.fc1(x)
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "ComfyUI/.venv/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
    return forward_call(*args, **kwargs)
  File "ComfyUI/comfy/ops.py", line 164, in forward
    return self.forward_comfy_cast_weights(*args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "ComfyUI/custom_nodes/ComfyUI-GGUF/ops.py", line 217, in forward_comfy_cast_weights
    out = super().forward_comfy_cast_weights(input, *args, **kwargs)
  File "ComfyUI/comfy/ops.py", line 157, in forward_comfy_cast_weights
    x = torch.nn.functional.linear(input, weight, bias)

Edit: the issue seems to be that I was using a gguf text encoder. Works fine with an unquantized version.

poyen-wu avatar Dec 21 '25 00:12 poyen-wu

LatentCutToBatch seems to have been added just two days ago, so it may not have made it into the desktop version yet? https://github.com/comfyanonymous/ComfyUI/commit/894802b0f9c3a247f5609db89ec3be24eac7fd2b

GOROman avatar Dec 21 '25 01:12 GOROman

Where is teh "Latent cut to batch" Node? It's not in Comfy-core

you need update comfyui version to 0.5.1

zansbang avatar Dec 21 '25 03:12 zansbang

Where is teh "Latent cut to batch" Node? It's not in Comfy-core

It was added in PR https://github.com/comfyanonymous/ComfyUI/pull/11411

poyen-wu avatar Dec 21 '25 03:12 poyen-wu

I used the q4 GGUF version, and for the VAE I used qwen_image_layered_vae. However, it reported an error at the end.

Image Image

zansbang avatar Dec 21 '25 03:12 zansbang

I used the q4 GGUF version, and for the VAE I used qwen_image_layered_vae. However, it reported an error at the end.

The CLIP should be qwen_2.5_vl_7b - not instruct - and the type for it is qwen image, not stable diffusion. You can use Qwen2.5-VL-7B-Instruct-your-GGUF for image captioning with some nodes but never as a text encoder.

GlamoramaAttack avatar Dec 21 '25 05:12 GlamoramaAttack

Ok, nice joke

Image

Does anyone know how to merge the layers back together?

Thanks

dan64 avatar Dec 21 '25 11:12 dan64

It's strange. I could use it normally yesterday, but after updating today, the same error message appeared.

I'm getting error below. I guess it's because I use comfy desktop with delayed support. Guess I'll need to wait for update. (Only if there was way to duel boot desktop and portable with shared model directory I might test it sooner...) Thank you for your help anyways.

Image Image Image

zpengcom avatar Dec 21 '25 14:12 zpengcom

Ok, nice joke

Image

Does anyone know how to merge the layers back together?

Thanks

Gimp or https://www.affinity.studio/photo-editing-software

or

from PIL import Image

# Load your edited layers (in order, background first)
layers = [
    Image.open("edited_layer_0.png").convert("RGBA"),
    Image.open("edited_layer_1.png").convert("RGBA"),
    Image.open("edited_layer_2.png").convert("RGBA"),
    Image.open("edited_layer_3.png").convert("RGBA"),
]

# Start with a blank canvas or the first layer
composite = Image.new("RGBA", layers[0].size, (0, 0, 0, 0))
for layer in layers:
    composite = Image.alpha_composite(composite, layer)

# Save the final image
composite.save("recomposed_image.png")

rzgarespo avatar Dec 21 '25 15:12 rzgarespo

Ok, nice joke Image Does anyone know how to merge the layers back together? Thanks

Gimp or https://www.affinity.studio/photo-editing-software

or

from PIL import Image

Load your edited layers (in order, background first)

layers = [ Image.open("edited_layer_0.png").convert("RGBA"), Image.open("edited_layer_1.png").convert("RGBA"), Image.open("edited_layer_2.png").convert("RGBA"), Image.open("edited_layer_3.png").convert("RGBA"), ]

Start with a blank canvas or the first layer

composite = Image.new("RGBA", layers[0].size, (0, 0, 0, 0)) for layer in layers: composite = Image.alpha_composite(composite, layer)

Save the final image

composite.save("recomposed_image.png")

a single ffmpeg command with an overlay filter should work just fine too

poyen-wu avatar Dec 21 '25 16:12 poyen-wu

Any advice to correct the vae loader error? I already updated ComyfUI to the latest commit. But this error keeps appearing while loading the qwen layered vae: Image

MoonMoon82 avatar Dec 21 '25 16:12 MoonMoon82

@dan64 imageCompositeMasked node?

manassm avatar Dec 21 '25 17:12 manassm

@dan64 imageCompositeMasked node?

ImageCompositeMasked worked perfectly!

Thanks

dan64 avatar Dec 21 '25 19:12 dan64