ComfyUI-FL-UnlimitedSVG
Baidu Unlimited-SVG image-to-SVG vectorization for ComfyUI: native port with CUDA-graph decoding (~6x faster than the reference), SVG output, rasterize and save nodes, automatic model download
FL UnlimitedSVG
Image-to-SVG vectorization for ComfyUI, powered by Baidu's Unlimited-SVG. The model redraws any image (logos, icons, diagrams, illustrations, photos) as a structured, editable SVG: named groups, paths, gradients. It is built on DeepSeek-OCR: a SAM ViT-B + CLIP-L encoder compresses the image to 1,057 tokens, and a 3B mixture-of-experts language model (about 0.6B active per token) writes the SVG code.
This pack is a native port. The encoder and language model are reimplemented on ComfyUI's own torch ops, with a static KV cache and CUDA-graph decoding, so it needs no transformers, no trust_remote_code and no vLLM, and it writes SVG tokens about 6x faster than the reference Transformers pipeline.

Live vectorization in ComfyUI (real time, not sped up): the SVG drawing builds on the left while the code streams on the right, 8,242 tokens at ~760 tok/s on an RTX PRO 6000 (v1.1.0).


Features
- Image to editable SVG: any
IMAGEin; batches are vectorized image by image - Live preview on the node: watch the drawing build up (left) while the SVG code streams in (right), with token count and speed
- Native ComfyUI
SVGoutput: works with core nodes such as Save SVG, plus a rasterizedIMAGEpreview and the raw SVG text - Fast decoding: fused Triton kernels, static KV cache and CUDA graphs, about 700 to 890 tokens/s on an RTX PRO 6000 versus about 55 for the reference
- Automatic model download: the loader fetches the pinned checkpoint from Hugging Face on first run
- Crop to image: the model draws on a padded square canvas; the SVG is re-framed to your image's own aspect ratio (optional)
- Transparency aware: connect the Load Image
MASKand transparent pixels are composited onto white, like upstream - Resolution-free rendering: rasterize any SVG at up to 16K with resvg
- ComfyUI memory management: the model loads and offloads through ComfyUI's model manager; generation can be interrupted
Nodes
| Node | Description |
|------|-------------|
| FL UnlimitedSVG Model Loader | Downloads (if needed) and loads Unlimited-SVG |
| FL UnlimitedSVG Vectorize | Image to SVG with a live preview panel; outputs SVG, a rasterized preview IMAGE and the SVG text |
| FL UnlimitedSVG Rasterize | Renders SVG to an IMAGE at any size |
| FL UnlimitedSVG Save SVG | Writes plain .svg files to the output folder and previews them on the node |
Installation
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI-FL-UnlimitedSVG.git
cd ComfyUI-FL-UnlimitedSVG
pip install -r requirements.txt
Or search for ComfyUI-FL-UnlimitedSVG in ComfyUI Manager.
Models
On first execution, FL UnlimitedSVG Model Loader downloads baidu/Unlimited-SVG into ComfyUI/models/unlimited_svg/Unlimited-SVG:
| File | Size |
|------|------|
| model-00001-of-000001.safetensors | 6.7 GB |
| tokenizer.json, config.json, LICENSE | 10 MB |
Disable download_if_missing to require files you placed there yourself. The folder can also be set with an unlimited_svg: entry in extra_model_paths.yaml.
Quick Start
- Load the example workflow
examples/unlimited_svg_vectorize.json. - Pick an image in Load Image. For photos and paintings, set
temperatureto about 0.6. - Queue. The SVG lands in
output/UnlimitedSVG/.
Settings
temperature(default 0): 0 is greedy decoding, the upstream default and the best choice for logos, icons, CAD drawings, diagrams and charts (upstream suggests 0 to 0.3). For photos and natural scenes upstream suggests 0.5 to 0.8.seed: only used whentemperatureis above 0.max_new_tokens(default 30000, as upstream): an upper bound. A logo takes about 2K tokens and a detailed illustration about 15K to 25K. If the limit is hit, the open tags are closed and the partial drawing is returned.crop_to_image(default on): the model always draws on a 1024 x 1024 canvas covering the image padded to a 2048 px square. On re-frames theviewBoxto the original image area; off keeps the raw canvas exactly as written.top_p,top_k,repetition_penalty: sampling controls, off by default as upstream. A smallrepetition_penaltysuch as 1.02 can break the rare greedy loop on busy images, at the cost of slightly bent coordinates.preview_size: long edge of the rasterized previewIMAGEoutput.- Live preview: the node panel updates about three times a second while tokens are written. The partial SVG is closed off so it renders; streaming costs no measurable speed. It shows in the browser tab that queued the run.
precision(loader):bf16(6.7 GB) is the upstream precision;fp32(13.4 GB) rounds less, so greedy runs depend less on near-tied tokens, and is about 25% slower.cuda_graphs(loader): on by default; off only for debugging.
Performance
Measured on an RTX PRO 6000 Blackwell Max-Q (bf16, model loaded, warm), decoding a fixed number of tokens:
| Decode speed | Logo (2K tokens) | Painted house (16K tokens) | |---|---|---| | Reference Transformers pipeline | about 55 tok/s | slower | | PyTorch path (v1.0.0, or no Triton) | 361 tok/s | 322 tok/s | | Triton fast path (v1.1.0, default when Triton is installed) | 875-889 tok/s | 691-697 tok/s |
- The fast path uses fused Triton kernels for single-token decode: MoE experts read in place, fused RMSNorm/RoPE/KV-cache write/SiLU, autotuned GEMV, flash-decoding attention over the live length, several decode steps plus sampling per CUDA-graph replay, and a parallel graph branch for the shared experts. It keeps the original rounding points; only summation order changes.
- Triton is optional. Without it (or with
FL_USVG_DISABLE_TRITON=1) the pack uses the PyTorch path. On Windows installtriton-windowsto get the fast path. bf16 needs an RTX 30 series or newer GPU. - Encode + prefill take about 0.25 s per image. The first run captures CUDA graphs and autotunes the kernels (a few seconds once per session).
- Peak VRAM is about 10-11 GB in bf16 (6.7 GB of weights plus up to 2 GB of KV cache), about 20 GB in fp32.
Accuracy
The port was checked against the upstream infer_hf.py pipeline on the same input. The SAM encoder, the CLIP encoder and the language model match the upstream modules bit for bit in the same PyTorch build, and incremental (graph) decoding matches a full forward pass exactly in fp32. In bf16, the language model's logits are rounded to bf16, so many next-token choices are exact ties; different PyTorch builds or kernels (including upstream's own code on different torch versions) can break those ties differently, and greedy outputs then diverge after a few hundred tokens while staying equivalent drawings.
Changelog
- v1.1.0: fast decode path with optional Triton kernels: 2.4x faster on short SVGs (logo 361 -> 875 tok/s warm) and 2.2x on long ones (16K-token house 322 -> 691 tok/s), same VRAM. Works under ComfyUI's default cudaMallocAsync allocator. Falls back to the v1.0.0 PyTorch path when Triton is missing (or with
FL_USVG_DISABLE_TRITON=1). - v1.0.0: first release: native ComfyUI port of Unlimited-SVG with CUDA-graph decoding, live SVG preview on the node, Rasterize and Save SVG nodes.
Requirements
- NVIDIA GPU with bf16 support (RTX 30 series or newer), 12 GB VRAM recommended
- Python 3.10+
resvg-pyfor rasterizing (installed byrequirements.txt)
Credits
- Unlimited-SVG by Baidu, built on DeepSeek-OCR
- The encoder and language model in
modules/are reimplemented from the upstream code; seeTHIRD_PARTY_NOTICES.md - SVG rendering by resvg
License
MIT, matching the upstream Unlimited-SVG code and weights (Copyright (c) 2026 Baidu). The weights are downloaded from Hugging Face and not redistributed here.