baidu/Unlimited-SVG
Machine LearningRedraw any image as an editable SVG with a compact 0.5B-activated multimodal model.
What it does
Unlimited-SVG is a multimodal model that traces an input image into a structured, editable SVG instead of a flat raster redraw. The model is built on DeepSeek-OCR: DeepEncoder compresses a 2048 × 2048 image into 1024 vision tokens while keeping small text, thin strokes, and exact coordinates, and a mixture-of-experts decoder activates roughly 0.5B parameters per token.
The intended problem is long output. A complete SVG for a complex image can exceed 10,000 tokens, and the project claims the architecture keeps generation practical at that length on a local GPU rather than a hosted frontier API. The code is Python and the model weights are published on Hugging Face and ModelScope.
Run inference with Transformers
Preparation: x86-64 Linux, uv, a compatible NVIDIA driver, and a free BF16-capable GPU. Both official paths resize the image with ImageOps.pad to a 2048 × 2048 gray canvas, preserving aspect ratio and flattening transparency onto white.
uv venv .venv-svg-hf --python 3.12
uv pip install --python .venv-svg-hf/bin/python \
torch==2.6.0 torchvision==0.21.0 transformers==4.46.3 tokenizers==0.20.3 \
safetensors==0.8.0 pillow==13.0.0 einops==0.8.2 addict==2.4.0 \
easydict==1.14 accelerate==1.16.0 requests==2.34.2 \
huggingface_hub==0.36.0
Save the README's Transformers script as infer_hf.py, then run it from the repository root:
CUDA_VISIBLE_DEVICES=0 .venv-svg-hf/bin/python infer_hf.py /path/to/image.png
The first run downloads the weights from baidu/Unlimited-SVG into the Hugging Face cache; later runs reuse them. The script writes the raw model output to output.txt, extracts the <svg> element, validates it with ElementTree, and saves output.svg. If the SVG is incomplete, it raises an error instead of writing a broken file.
vLLM serving option
The README also documents a vLLM path: install a separate environment, patch the DeepSeek-OCR image processor to 2048 × 2048 without tiling, start vllm serve baidu/Unlimited-SVG on port 10000, and call it with an OpenAI-compatible client script. This is more involved and version-pinned; see the README inference section for the exact environment and server flags rather than mixing the two setups.
Sampling guidance
Greedy decoding is the default (do_sample=False in Transformers, temperature=0 in vLLM) and gives deterministic output. For CAD, diagrams, and charts that need precise geometry and text, keep temperature low (0–0.3); for natural scenes and photos, 0.5–0.8 reduces repetitive loops and varies strokes.
Constraints
- Linux x86-64 with an NVIDIA GPU is required; the instructions assume a BF16-capable card and do not cover CPU or Apple Silicon.
- The Transformers and vLLM paths use different dependency pins and should live in separate environments. The vLLM setup edits a file inside the installed
vllmpackage, so it is tied to the listed version. - Generation allows up to 30,000 new tokens; long or dense images can still produce incomplete SVG, which the scripts detect but cannot repair.
- The model runs with
trust_remote_code=True, so reviewing the downloaded modeling code is part of running it. - Licensed MIT; model weights are distributed separately on Hugging Face and ModelScope.
HotRepo's take
On the HotRepo new-project list for 2026-12-01, Unlimited-SVG recorded 98 stars and 6 forks in a one-hour window, moving from 197 to 244 sampled stars. That is a single short observation and does not describe sustained adoption or output quality. The notable technical point for readers is the combination of a 1024-token vision prefix and ~0.5B activated parameters, which is what makes the long-SVG use case plausible on a single local GPU; whether it holds up on your own diagrams and photos depends on the sampling setting and the 30k-token ceiling.
Written by AI from the project's public information and HotRepo's records, updated . The project's own docs are the source of truth.