Model reference · open weights
Unlimited-SVG is an open-weight language model from Baidu. Unlimited-SVG (BF16) weighs 6.7 GB; the smallest configuration that runs it is RTX 3060 12 GB.
For self-hosting, compare this build's requirements below with the GPU you plan to rent.
Summary of the baidu/Unlimited-SVG model card, 2026-12-01
What it is
| Released by | Baidu |
|---|---|
| Released | 2026-11-25 |
| Parameters | 3.3B |
| VRAM | 6.7 GB for the weights |
What it runs on
| Card | Requests at once | Context max | Memory | |
|---|---|---|---|---|
| 8K each | 32K each | |||
| RTX 3060 12 GB | 5 | 1 | all 32K | 11.6 GB |
| RTX 4060 Ti 16 GB | 12 | 3 | all 32K | 15.4 GB |
| RTX 3090 24 GB | 28 | 7 | all 32K | 23.4 GB |
| RTX 4090 24 GB | 28 | 7 | all 32K | 23.4 GB |
| RTX 5090 32 GB | 43 | 10 | all 32K | 31.0 GB |
| L40S 48 GB | 69 | 17 | all 32K | 44.0 GB |
| A100 80 GB | 137 | 34 | all 32K | 78.2 GB |
| H100 80 GB | 128 | 32 | all 32K | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | 159 | 39 | all 32K | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | 186 | 46 | all 32K | 107 GB |
| H200 141 GB | 246 | 61 | all 32K | 138 GB |
| B200 180 GB | 319 | 79 | all 32K | 176 GB |
| 2× RTX 3060 12 GB tensor parallel | 23 | 5 | all 32K | 11.6 GB a card |
| Requests at once | 8K tokens each | 32K tokens each |
|---|---|---|
| 1 | 9.4 GB | 10.9 GB |
| 5 | 11.4 GB | 19.0 GB |
| 8 | 12.9 GB | 25.0 GB |
| 16 | 17.0 GB | 41.1 GB |
| 32 | 25.0 GB | 73.3 GB |
| 64 | 41.1 GB | 138 GB |
One card, with vLLM's small-card settings.
From the model card
Generating a complete SVG for a complex image often exceeds 10,000 tokens—a long-context regime where large models quickly become slow and prohibitive. Built on DeepSeek-OCR, Unlimited SVG breaks this bottleneck from both ends.
On the input side, DeepEncoder compresses an entire 2048 × 2048 image into just 1024 vision tokens while preserving fine details such as small text, thin strokes, and exact spatial coordinates—dramatically shrinking the visual prefix before decoding even begins.
On the decoding side, its mixture-of-experts (MoE) architecture activates only ~0.5B parameters per token. Minimal visual prefix meets sparse active compute: Unlimited SVG sustains real-time generation well past 10,000 tokens—making long-horizon, complex SVG conversion practical on a compact, locally deployable model rather than relying on heavy frontier APIs like GPT-6.2 Astra and Claude Fable 5.2.
Run from the repository root on x86-64 Linux with uv, a compatible NVIDIA
driver, and a free BF16-capable GPU. Use the Hugging Face model baidu/Unlimited-SVG, which supports
2048 × 2048 global inference. Both examples use ImageOps.pad to resize
the long edge to 2048 pixels while preserving the aspect ratio, then center
the image on a gray 2048 × 2048 canvas without tiling. Transparent pixels
are composited onto white first, so images with alpha do not turn black.
Both examples run greedily by default (do_sample=False in Transformers,
temperature=0 in vLLM) for deterministic output. Tune the sampling
temperature to the image type:
0–0.3) to preserve
precise geometry and text.0.5–0.8) to
avoid repetitive loops and encourage more varied strokes.To sample with Transformers, pass do_sample=True and a temperature
instead of the greedy override above; with vLLM, set temperature in the
request.
Install dependencies.
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 following code as infer_hf.py.
import re
import sys
from pathlib import Path
from tempfile import TemporaryDirectory
from xml.etree import ElementTree
import torch
from PIL import Image, ImageOps
from huggingface_hub import snapshot_download
from safetensors import safe_open
from safetensors.torch import load_file
from transformers import AutoModel, AutoTokenizer
model_name = "baidu/Unlimited-SVG"
image_path = sys.argv[1]
def flatten_alpha(image):
"""Composite transparent pixels onto white so they do not turn black."""
if image.mode not in ("RGBA", "LA", "PA") and "transparency" not in image.info:
return image.convert("RGB")
rgba = image.convert("RGBA")
white = Image.new("RGB", rgba.size, (255, 255, 255))
white.paste(rgba, mask=rgba.getchannel("A"))
return white
model_path = snapshot_download(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
options = {"low_cpu_mem_usage": True}
weights = list(Path(model_path).glob("model*.safetensors"))
if len(weights) == 1:
with safe_open(weights[0], framework="pt", device="cpu") as shard:
metadata = shard.metadata()
if metadata is None:
options = {"low_cpu_mem_usage": False, "state_dict": load_file(weights[0])}
model = AutoModel.from_pretrained(
model_path, trust_remote_code=True, use_safetensors=True,
torch_dtype=torch.bfloat16, attn_implementation="eager", **options,
).eval().cuda()
original_generate = model.generate
def generate(*args, **kwargs):
kwargs.pop("temperature", None)
kwargs.update(max_new_tokens=30000, no_repeat_ngram_size=0,
do_sample=False, repetition_penalty=1)
return original_generate(*args, **kwargs)
model.generate = generate
with TemporaryDirectory() as directory:
prepared = Path(directory) / "input.png"
with Image.open(image_path) as image:
ImageOps.pad(
flatten_alpha(ImageOps.exif_transpose(image)), (2048, 2048),
method=Image.Resampling.BICUBIC, color=(127, 127, 127),
).save(prepared)
with torch.inference_mode():
raw = model.infer(
tokenizer, prompt=" SVG:", image_file=str(prepared),
output_path=directory, base_size=2048, image_size=2048,
crop_mode=False, eval_mode=True,
)
Path("output.txt").write_text(raw, encoding="utf-8")
match = re.search(r"", raw, re.DOTALL)
if match is None:
raise RuntimeError("Incomplete SVG. See output.txt.")
svg = match.group()
ElementTree.fromstring(svg)
Path("output.svg").write_text(svg, encoding="utf-8")
CUDA_VISIBLE_DEVICES=0 .venv-svg-hf/bin/python infer_hf.py /path/to/image.png
The first run downloads the model weights from Hugging Face and stores them in the local Hugging Face cache. Subsequent runs reuse the cached files.
Install dependencies.
uv venv .venv-svg-vllm --python 3.12
uv pip install --python .venv-svg-vllm/bin/python \
vllm==0.33.0 torch==2.14.0 nvidia-cudnn-cu13==9.24.0.43 \
openai==3.60.0 pillow==13.0.0
Set the server image processor to 2048 × 2048 without tiling.
.venv-svg-vllm/bin/python - <<'PY'
import re
import sysconfig
from pathlib import Path
path = Path(sysconfig.get_path("purelib")) / "vllm/transformers_utils/processors/deepseek_ocr.py"
source = path.read_text()
for name, valueQuoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.