Qwen3-VL Unified Input Embeddings
Turn a Qwen3-VL prompt into saved embeddings you never re-encode
- clip
- State Dict
- Embeddings
Every time you run a workflow with a Qwen3-VL encoder, it re-tokenizes and re-encodes the same prompt. If you're generating hundreds of images from the same prompt - a training dataset, a batch, a style test - that's a lot of wasted compute. UC_Qwen3VLInputEmbeds pre-computes the input embeddings for a text prompt (with optional images), hands you the raw tensors, and saves them as .safetensors files in your embeddings folder. One encode, reusable forever.
It's part of silveroxides/ComfyUI-UtilsCollection, and it's the kind of node that makes sense if you're building training datasets or batch pipelines on Qwen3-VL. The key detail in the schema: the prompt "skips any template wrapping" - you're getting the bare input embeddings, not a fully-formed conditioning, which is exactly what you want when you'll be assembling conditioning yourself later.
What's on the node
- clip - your Qwen3-VL encoder (4B or 8B).
- prompt - the text. No template wrapping is applied; if you feed images, the node inserts the vision tokens around the text itself.
- image_paths - line-separated paths to image files, if you want visual tokens in the embedding.
- file_names - line-separated names to save as (no
.safetensorsextension; nested subfolders allowed). Must map 1-to-1 withimage_paths. - vlm_resolution - resolution passed to the VLM's semantic path:
Fast (384)default up throughXX-Large (1536), plusOriginal. Higher = more faithful, more tokens. - slice_visual_tokens - if true, removes the first validated visual-token span, leaving the text tokens; false keeps the full interleaved sequence. Leave false unless you specifically want text-only output from a mixed input.
Outputs
- State Dict - a dict of
{key_name: tensor_2d}with shape[num_tokens, hidden_size]. - Embeddings - the raw 2D tensor itself.
Both are the same data in two shapes; the State Dict is what you'd stash in a .safetensors file, and the tensor is what you'd pipe into a custom conditioning builder.
Installing it
Via the pack:
- ComfyUI Manager: search "ComfyUI-UtilsCollection".
- Or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
Restart ComfyUI. No extra pip deps beyond the pack's standard ones, but you need a Qwen3-VL encoder loaded.
Gotchas
The path lists are strictly 1-to-1 - mismatched counts raise an error before any processing starts, which is the good kind of failure (the node validates all paths up front so you don't discover a missing file halfway through). The files land in your standard models/embeddings folder, and the tooltip's filename convention is name.safetensors without you typing the extension. The real thing to internalize: this is a savings tool, and it only pays off if you actually reuse what it saves. If you're running one-off prompts, it's overhead, not help - build it into a batch or dataset pipeline and it quietly removes the most repeated cost in the graph. And don't forget the saved embeddings encode a specific resolution and template state; reusing them with different settings than you saved won't necessarily match.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| prompt | STRING | Input text prompt. Important: skips any template wrapping. | |
| image_paths | STRING | Line-separated list of paths to image files. Must map 1-to-1 with file_names. | |
| vlm_resolution | COMBO | Fast (384) | Resolution of the image passed to the VLM (semantic path). |
| file_names | STRING | Line-separated list of file names to save as (without .safetensors). Can include nested subfolders. Must map 1-to-1 with image_paths. | |
| slice_visual_tokens | BOOLEAN | false | If True, removes the first validated visual-token span. If False, preserves the full interleaved sequence. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| State Dict | * | Dictionary structure: {key_name: tensor_2d} of shape [num_tokens, hidden_size] |
| Embeddings | * | Raw PyTorch 2D tensor of shape [num_tokens, hidden_size] |