Repository navigation
Add Unlimited-SVG (image to SVG): OpenVINO export, engine and /v1/chat/completions - #207
Closed
SearchSavior wants to merge 6 commits into
Closed
SearchSavior wants to merge 6 commits into
SearchSavior wants to merge 6 commits into
Conversation
… transformers to 5.11-5.15 OpenVINO GenAI 2026.4+ ships the DeepSeek-OCR-2 VLMPipeline path that Unlimited-SVG support will build on; optimum-intel 2.3 exports deepseek_ocr2 and needs transformers <5.16 (deepseek_ocr2 landed in 5.11). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011SRNH9d4WxeGDc2LLVLJK6
Unlimited-SVG is exported and served with OpenArc's own code (no GenAI VLMPipeline, no optimum-intel export), so the bump is not needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011SRNH9d4WxeGDc2LLVLJK6
baidu/Unlimited-SVG (image to editable SVG; DeepSeek-OCR v1 vision, DeepSeek-V2
MoE decoder) exported and served with OpenArc's own code, separate from the
ov_genai VLM engine:
- export.py: three IRs from the checkpoint's own modules (run with
transformers 4.46.3 via `uv run --with`, the project env is untouched):
- vision: SAM + CLIP + projector over the 2048 global view, newline and
view-separator tokens included; SAM's relative-position bias folded into
query and key so global attention runs as one fused SDPA;
- text embeddings;
- stateful language model. The routed experts are in the tiled 3-GEMM form
the CPU plugin turns into GatherMatmul (only the 6 routed experts run).
int8 / int4 / fp16 via NNCF, MoE routers left uncompressed. Expert stacks
are shared f16 constants, so the export peaks at ~9 GB.
- prompt.py: the trained prompt `<image> SVG:` built verbatim (no chat
template), one base64 image, the model card's image preparation.
- sampling.py: greedy at temperature 0, else temperature / top-k / top-p
with repetition, frequency and presence penalties.
- pipeline.py: vision -> splice -> prefill -> decode loop with stats.
- unlimited_svg.py: OVUnlimitedSVG speaking the chat worker's protocol
(streaming, cancel, request errors that keep the model loaded).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH9d4WxeGDc2LLVLJK6
- ModelType.UNLIMITED_SVG on the openvino engine, its own worker queue, served by the chat route; a request the model cannot answer (no image, two images, tools, response_format) is a 400 and the model stays loaded. - sampler_config applies to unlimited_svg; `openarc add --model-type unlimited_svg`. - The chat route reports finish_reason "length" when an engine says it stopped at the token budget. - Unit tests (request rules, preprocessing, prompt ids, sampler, pipeline loop on fake parts, engine protocol and cancel, worker, route, and the export's rewritten attention and experts against plain PyTorch) and an integration test on an exported int8 IR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011SRNH9d4WxeGDc2LLVLJK6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011SRNH9d4WxeGDc2LLVLJK6
Measured int8, int4 and fp16 exports: size, vision / prefill / decode times, peak memory while serving, and how their SVGs compare with the PyTorch reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011SRNH9d4WxeGDc2LLVLJK6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds baidu/Unlimited-SVG (MIT), which redraws an image as an editable SVG. It is served as model type
unlimited_svgon theopenvinoengine, through/v1/chat/completions.It follows the approach of the d1 PR (#206): OpenArc's own export script, pipeline and engine, all in
src/engine/openvino/unlimited_svg/. Nothing is added tosrc/engine/ov_genai/vlm.py. optimum-intel and OpenVINO GenAI cannot export or run this model's vision encoder (DeepSeek-OCR v1: SAM + CLIP), so the whole path is self-contained.Export (
export.py)The checkpoint's remote code needs transformers 4.46.3.
uv run --withprovides it for the export only, and the project's dependencies are unchanged. The branch carries a dependency bump and its revert, so their net diff is zero. The bump turned out to be unnecessary once the model is exported and run with OpenArc's own code.The export writes three IRs:
ConvertTiledMoeBlockTo3GatherMatmulsmatches. The CPU plugin runs them asGatherMatmul, computing only the 6 routed experts per token. That takes decode from 3.2 to about 23 tok/s.MatMul(transpose_b=True). Two other approaches failed. OpenVINO's 16-bit patch casts registered 16-bit buffers to f32. A transposed copy in the trace OOMs.Weight formats are
int8(recommended),int4(the language model; group 64), andfp16. The MoE routers stay at full precision.Prompting
Prompting was decided by measurement. The model was trained on
<image> SVG:with no chat template. With vLLM's DeepSeek-VL2 template, the reference model answered with no<svg>, or ran to the token cap. Soprompt.pybuilds the prompt verbatim:data:image.<image>tag is used as written. Text without the tag follows the image. An image alone gets<image> SVG:.Images are prepared as on the model card: EXIF rotation, alpha flattened onto white, then padded to 2048 with BICUBIC.
Serving
OVUnlimitedSVGhas its own worker queue. It supports streaming and cancellation: a client disconnect stops the generation.tools, aresponse_formatother than text, and/v1/completions.sampler_configapplies tounlimited_svg. Temperature 0 is greedy.finish_reason: "length"when an engine says it stopped at the token budget. Other engines are unaffected.openarc add --model-type unlimited_svgworks.Docs: a new
docs/unlimited_svg.mdpage, plus updates tomodels.md,configure.md, the README and the nav.Validation
Forwards vs. the checkpoint's own PyTorch code, in f32. The vision encoder matches to 9e-5. The decoder matches to 1e-5, including cached decode steps.
OpenVINO vs. the reference PyTorch model (bf16, greedy). Three images: an icon, a bar chart and a diagram.
The chart and diagram MAEs are high for every row because the grey padding is part of the scored image.
The outputs are not token-identical to the reference. fp16 diverges at the same points as int8, so the drift comes from bf16 compute, not quantisation. It shows up as small coordinate changes.
Timing. Measured on a 4-core Xeon (AMX, bf16 by default): the vision encoder takes 12 to 13 s per image, and prefill about 2 s.
Memory. Peak RSS while serving is 12.7 GB for int8 and 11.2 GB for int4. fp16 does not fit in 15 GB: its decoder alone takes about 10.8 GB on CPU.
End to end with the OpenAI client against a running server, all passed:
max_tokensgivesfinish_reason: "length";Test plan
uv run pytest tests/unitpasses: 41 new tests. The 2 Kokoro failures are pre-existing and fail on main too.tests/integration/test_ov_unlimited_svg_integration.pypasses on an int8 export (TEST_MODEL_PATHmust containUnlimited-SVG-int8).zensical buildsucceeds. Its warnings are all pre-existing ones inindex.md.