Nodes/Lance-3B AIO/Lance Configure
ComfyUI Node

Lance Configure

Why every Lance workflow passes through this tiny node

By SteveImmanuel·Created 4 months ago·Updated 3 months ago· 8
Lance Configure
  • lance
  • tokenizer
  • LANCE
  • NEW_TOKEN_IDS

Lance Configure looks like a do-nothing pass-through node, and honestly, in the ComfyUI sense it kind of is: it takes a LANCE in and hands a LANCE back out. But skip it and your whole workflow errors out. It's the node that finalizes the model for inference - the plumbing step every Lance graph needs between loading the weights and actually running them.

The comfyui-lance-aio pack ports ByteDance's Lance-3B, a single Apache 2.0 model that does image/video generation, editing, and understanding. Lance ships its tokenizer and embedding tables expecting a few special tokens that aren't in the base vocab. Before you can generate or caption anything, those tokens have to exist, and the model's embedding matrix has to grow to match. That's exactly what this node does.

What it does

Feed it two things: the LANCE object from the Lance Loader, and the TOKENIZER from the Lance Tokenizer Loader. In return you get:

  • LANCE - the same model, but now with the tokenizer attached, the embedding table resized, and its vocab size updated to match.
  • NEW_TOKEN_IDS - a map of the newly added special token IDs. This flows into every prompt node and into the generation/understanding output nodes, which need to know which token ID means "image starts here", "text starts here", and so on.

Under the hood it adds four special tokens - <|im_start|>, <|im_end|>, <|vision_start|>, <|vision_end|> - then resizes the language model's token embeddings if any of them were missing, and registers the vision token ID from the model config. There's a safety assertion in there that the input and output embedding tables aren't tied to the same memory, because the Lance config explicitly wants untied embeddings; if the port's config handling ever drifted, you'd see the failure here rather than as a confusing NaN image later.

One detail worth knowing: this node also flips the model into eval mode. Not a big deal for a ComfyUI workflow, but it's a hint that the node is "finalizing", not just relaying.

When you don't need it

Rarely. Every included example workflow in the pack runs through Lance Configure - text-to-image, text-to-video, image understanding, the lot. It's cheap (no model reload, just a resize of the embedding table and a tokenizer update), so there's no reason to try to route around it. About the only situation where it's redundant is if you're reusing a LANCE object that's already been configured upstream in the same graph - and even then, running it again is harmless.

Installing the pack

This is a pack, not a standalone node, so installation is the whole kit:

cd ComfyUI/custom_nodes
git clone https://github.com/SteveImmanuel/comfyui-lance-aio
cd comfyui-lance-aio
pip install -r requirements.txt

ComfyUI Manager can also find it as comfyui-lance-aio. The requirements pin transformers>=4.50.3,<5 - the official Lance codebase doesn't work with transformers 5, so keep it under. Then download the Lance checkpoints from bytedance-research/Lance into ComfyUI/models/lance/ (the Lance_3B/ and Lance_3B_Video/ folders, plus Qwen2.5-VL-ViT/ and Wan2.2_VAE.pth). Restart ComfyUI after cloning and the nodes show up under the Lance category.

Troubleshooting

If you see a cryptic failure about token IDs or a mismatch when you run the generation node, check that the TOKENIZER feeding Lance Configure came from the Lance Tokenizer Loader pointed at the same checkpoint directory as the Lance Loader - the tokenizer and the model need to agree on vocab. And if your transformers somehow drifted to v5, the resize-token-embeddings call here is a likely place for the wheels to come off; pin it back below 5 and restart.

CategoryLance

Inputs (2)

NameTypeDefaultDescription
lanceLANCE
tokenizerTOKENIZER

Outputs (2)

NameTypeDescription
LANCELANCE
NEW_TOKEN_IDSNEW_TOKEN_IDS