Clone
2
Home
Mr.Lee edited this page 2026-12-01 19:20:03 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Unlimited-SVG 镜像同步记录与项目分析

维护说明:本页由 gitea-mirror-wiki 技能生成(2026-12-01 19:20),记录该仓库在 GPD Gitea 的镜像状态与代码速览。Wiki 属于本地维护内容,不来自上游,也不受 8 小时同步影响。

一、仓库概况

项目 值
上游 https://github.com/baidu/Unlimited-SVG.git
本地镜像 http://192.168.1.99:3000/jarod/Unlimited-SVG
公网入口 https://git.lxj.ai/jarod/Unlimited-SVG
状态 活跃镜像(8 小时自动同步)
默认分支 main
仓库大小 约 5.5 MB(DB 5757921 字节;裸仓约 5773 KB)
refs 1 分支 / 0 标签 / HEAD 历史 5 提交
建立时间 2026-12-01 19:09:45
描述 Unlimited SVG Works: Trace On - Projection of Visual Worlds into SVG-Anything (baidu, MIT, Python)

二、同步过程与当前状态

本次同步实测

项目 结果
上游仓库 https://github.com/baidu/Unlimited-SVG (百度 ERNIE 多模态团队「Unlimited SVG Works」,Python,MIT,699 star / 40 fork / 4 open issues,默认分支 main,创建于 2026-11-25,最后推送 2026-12-01,项目页 Unlimited-SVG.github.io;模型权重在 Hugging Face 与 ModelScope 的 baidu/Unlimited-SVG)
迁移请求 POST /api/v1/repos/migrate;mirror=true、mirror_interval=8h0m0s、private=false、repo_owner=jarod、repo_name=Unlimited-SVG;由 GPD 宿主侧 nohup 后台 curl(--max-time 7200)发起,配合独立 watcher 脚本判定,避开本机客户端超时误判
迁移结果 HTTP 201 Created,服务端实测耗时 9378.6 ms(约 9.38 秒),repo id 51,empty=false;上游约 5.5 MB(GitHub API size=5585 KB),全历史镜像裸仓 5.7 MB(DB size 5,757,180 字节 / API size=5622 KB);一次成功,未出现超时 422 空壳、未重发 migrate、无需手动接管
默认分支 main;裸仓 HEAD = 7dca319d1a34bf09476d76dbb88163508fcc9793,与 GitHub 上游 HEAD 完全一致(git ls-remote 比对)
refs 规模 1 分支(main)/ 0 标签 / 全 refs 9 提交(main 单分支历史 5 提交),另含 refs/pull/1/head、refs/pull/1/merge、refs/pull/3/head、refs/pull/3/merge 共 4 个 PR refs;HEAD 树仅 9 个文件;提交跨度 2026-11-30 → 2026-12-01,是现有镜像里最新、最小的仓库之一
远端配置 remote.origin.url = https://github.com/baidu/Unlimited-SVG.git;fetch 双 refspec(+refs/:refs/ 与 +refs/tags/:refs/tags/);无 remote.origin.proxy 等代理残留
同步排期 mirror_interval = 8h0m0s(interval=28,800,000,000,000 ns),enable_prune=1;POST /mirror-sync 返回 200 / 0.090 s,updated 2026-12-01 19:10:43 → next_update 2026-12-02 03:10:43(+8h),之后按 8 小时节奏自动拉取,无需人工干预
完整性校验 git fsck 无异常输出;裸仓属主 jarod:jarod(1000:1000),大小 5.7M;仓库页 /jarod/Unlimited-SVG 返回 200;API 返回 mirror=true、empty=false、default_branch=main、size=5622、mirror_interval=8h0m0s
仓库计数 同步后 Gitea 共 36 个仓库,其中 34 个活跃镜像(另含 anqing 静态归档、cn-edu 本地自建非镜像)
本次无异常 小仓一步式迁移一次成功;仓库名含大写与连字符,裸仓目录按 Gitea 规则归一化为小写 unlimited-svg.git,Wiki 工具 --repo 大小写归一化正常;客户端与 GPD 全程 SSH 正常

当前校验状态

检查项 结果
is_mirror / is_empty 1 / 0
HEAD refs/heads/main → 7dca319
remote.origin.url https://github.com/baidu/Unlimited-SVG.git
remote.origin.fetch +refs/*:refs/* / +refs/tags/*:refs/tags/*
自动同步排期 updated 2026-12-01 19:10:43 → next 2026-12-02 03:10:43

页面验证:GET /jarod/Unlimited-SVG/wiki 返回 200 即表示 Wiki 裸仓已被 Gitea 正确识别。

三、项目功能速览

README 来源:README.md

## Release
- [2026/12/01] 🤝 Thanks to [AK](https://x.com/_akhaliq) and [Hugging Face](https://huggingface.co/) for creating a demo for us. It is now available at [Hugging Face Spaces](https://huggingface.co/spaces/akhaliq/Unlimited-SVG-ZeroGPU).
- [2026/12/01] 🤝 Thanks to the [ModelScope community](https://github.com/modelscope) for their support. Our model is now available at [ModelScope](https://modelscope.cn/models/baidu/Unlimited-SVG).
- [2026/12/01] 🚀 We present [Unlimited-SVG](https://github.com/baidu/Unlimited-SVG/), a multimodal model that redraws any image as a structured, editable SVG using just 0.5B activated parameters.
## Overview
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, locall
## Inference
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

顶层目录:(根目录)、assets

四、代码功能与安全简析(人工复核)

一、功能定位

Unlimited-SVG(Unlimited SVG Works: Trace On — Projection of Visual Worlds into SVG-Anything) 是百度 ERNIE 多模态团队 2026-11-25 发布的「任意图像 → 结构化、可编辑 SVG」多模态模型发布仓,699 star,MIT。它基于 DeepSeek-OCR 改造,从两头解决「复杂图像生成完整 SVG 常超 10,000 token、大模型在此长上下文下又慢又贵」的瓶颈:输入侧 DeepEncoder 把 2048×2048 整图压成 1024 个 vision tokens(仍保留小字、细笔画、精确坐标);解码侧 MoE 架构每 token 仅激活约 0.5B 参数,从而能在本地可部署的小模型上实时生成长篇 SVG,而非依赖重型前沿 API。

需要明确:这个仓库不是训练代码,只是「推理示例 + 文档 + 演示素材」。模型权重托管在 Hugging Face baidu/Unlimited-SVG 与 ModelScope baidu/Unlimited-SVG,第三方还做了一个 HF Spaces ZeroGPU 演示;它们都不在本仓库、也不随 8h 镜像同步。

二、技术栈与工程结构

项 情况
体量 HEAD 树仅 9 个文件;2 个 Python 推理脚本共 120 行;最大文件是 5.59 MB 的 assets/unlimited-svg-case-studies.gif 演示动图,其次 logo.png 129 KB、README.md 10.9 KB
许可 LICENSE = MIT(Copyright (c) 2026 Baidu);CONTRIBUTING.md 中英双语,要求 PEP 8、单测、GitHub Actions 通过
依赖 无 requirements.txt / pyproject.toml / setup.py / Dockerfile / CI workflow;依赖版本逐项精确 pin 在 README 的 uv pip install 命令里(py3.12 venv)
LFS .gitattributes 为 30+ 种模型/二进制扩展名(.safetensors、.pt、.onnx、.bin、.zip 等)配了 Git LFS 规则,但当前仓库内没有任何 LFS 对象——权重确实不在这里
推理路径 A infer_hf.py:torch 2.6.0 / transformers 4.46.3 / tokenizers 0.20.3 / safetensors 0.8.0 / pillow 13.0.0 / einops / addict / easydict / accelerate 1.16.0 / requests 2.34.2 / huggingface_hub 0.36.0
推理路径 B infer_vllm.py:vllm 0.33.0 / torch 2.14.0 / nvidia-cudnn-cu13 / openai 3.60.0 / pillow;本地起 vllm serve --host 127.0.0.1 --port 10000 --max-model-len 32768
预处理 两支一致:exif_transpose → 透明像素合成白底 → ImageOps.pad 长边缩到 2048、灰 (127,127,127) 居中补成 2048×2048、不切块
生成 默认贪心(Transformers do_sample=False / vLLM temperature=0),max_new_tokens=30000、prompt <image> SVG:;正则抽 <svg>…</svg> 后用 xml.etree.ElementTree.fromstring 校验并写 output.svg

三、安全快检结论(只做防御性审查)

  • 无敏感文件:全树 9 个文件中没有 .env / .pem / .p12 / .key / .p8 / id_rsa / credentials / secrets / .npmrc / .pypirc,也没有 CI workflow 或 shell 安装脚本。
  • 密钥关键词 2 处均为占位:README 与 infer_vllm.py 的 client = OpenAI(base_url="http://127.0.0.1:10000/v1", api_key="EMPTY", timeout=6000) —— EMPTY 是 vLLM 本地 OpenAI 兼容服务的惯用占位值,不是真实凭据。
  • 危险模式命中 1 处为误报:infer_hf.py:41 的 .eval().cuda() 是 PyTorch 把模型切到 eval 并移到 GPU 的正常链式调用;全树未见 curl|sh、wget|sh、sudo、eval(、os.system、subprocess、shell=True、pickle.load / torch.load。
  • 网络面很窄:仅 snapshot_download("baidu/Unlimited-SVG")(首次从 HF 下权重到本机缓存)与 vLLM 客户端连接 127.0.0.1:10000;无遥测、无 analytics、无外部 API key、无回连上报。
  • 正面配置:LICENSE 明确 MIT;依赖逐项 pin;vLLM 服务显式绑 127.0.0.1 而非 0.0.0.0;输出经 XML 解析校验后才落盘。
  • 关于本页自动扫描章节的 16 处命中:Wiki 自动章节按 password|secret|token|api_key|private_key|access_key 全树扫描报「命中 16 处」,逐条核对后为 14 处 token 系正常词(README 里的 tokens / vision tokens、依赖 tokenizers==0.20.3、AutoTokenizer、max_new_tokens / max_tokens 等)加 2 处 api_key="EMPTY" 占位;password、secret、private_key、access_key 均为 0 处。与人工复核结论一致,不存在凭据泄露,勿被自动计数误导。

四、风险提示与建议

  1. 镜像里没有模型,这是最需要先说清的:8h 同步只带 9 个源码/文档/演示素材文件(裸仓 5.7 MB),权重在 HF / ModelScope、演示在 HF Spaces,均不随镜像同步。内网或离线使用必须另外准备权重缓存。本次尝试查询 HF 模型卡未成功,权重许可与商用条款需在使用前单独确认——代码 MIT 不等于权重 MIT。另注意 .gitattributes 已铺好 LFS 规则:若上游日后把权重提交进仓库,镜像里只会变成 LFS 指针(Gitea 默认不拉 LFS 内容),需另行处理。
  2. trust_remote_code=True 是最大执行面:Transformers 的 AutoTokenizer.from_pretrained / AutoModel.from_pretrained 与 vllm serve --trust-remote-code 都会执行模型仓库自带的自定义 Python 代码,且模型从 HF 在线拉取。建议在隔离容器/专用构建机上先审模型仓代码再运行,不要在有敏感数据的办公机上直接跑;HF 账号与模型文件完整性属于另一条需要单独信任的供应链。
  3. vLLM 安装步骤会改写第三方包源码:README 的内联脚本用 re.subn 直接修改 site-packages 中 vllm/transformers_utils/processors/deepseek_ocr.py(把 BASE_SIZE/IMAGE_SIZE 改为 2048、CROP_MODE=False),再 replace() 覆盖原文件——无备份、无版本校验,只检查替换次数为 1。这是「改全局环境」的操作,务必放在专用 venv 内,升级 vllm 后需重新执行并复核;与「依赖精确 pin」相比,这里是工程上较脏的一处。
  4. 输出 SVG 未经净化:只做 ElementTree.fromstring 语法校验,模型生成的 SVG 仍可能含 <script>、foreignObject、外部 xlink:href / <image href> 等。若把 output.svg 直接嵌进网页或下发给学生浏览,需自行做白名单净化,或先栅格化为 PNG 再分发。
  5. 硬件与版本门槛偏高:要求 x86-64 Linux + 兼容 NVIDIA 驱动 + BF16 能力 GPU;两条路径的 torch 版本还不一致(2.6.0 vs 2.14.0),vLLM 侧要 cuDNN 13;max_new_tokens=30000 / max-model-len 32768 的长上下文显存占用不低。现有办公机或纯 CPU 环境基本跑不动。
  6. 项目非常新、仍在快速变动:2026-11-25 创建、11-30 才有首个提交、12-01 一天内多次改 README,9 个提交里还带 4 个 PR refs。8h 自动同步期间 HEAD 漂移属正常现象;引用或复现实验前建议先固定 commit,而不是跟踪 main。

五、结论

代码本身非常干净——9 个文件 / 120 行、MIT、无凭据、无遥测、无危险脚本、网络面收敛到本地与 HF 下载——作为「用 DeepSeek-OCR 架构做长上下文 SVG 生成」的最小可复现推理示例,值得在带 BF16 GPU 的隔离环境里试用或做教学演示。真正要记住的是三点:① 这是模型发布仓,权重与在线演示都不在镜像里,离线用要另备权重并确认权重许可;② trust_remote_code=True 与「改写 vLLM 包源码」两步会执行/修改外部代码,别在办公机直接跑;③ 输出 SVG 只校验语法、未做净化,进校园网页前需先转 PNG 或做白名单过滤。

五、代码安全快检(自动)

  • password|secret|token|api_key|private_key|access_key 命中 16 处;此类命中多为变量名、UI 文案或协议字段,需人工复核,不等于存在凭据泄露。
  • 敏感文件(.env / *.pem / *.p12 / 私钥 / credentials 等):未检出
  • 硬编码 PEM 私钥:未检出
  • 危险脚本模式(curl|bash / eval / base64 -d / chmod 777):未检出

六、风险提示

  1. 自动快检只覆盖常见模式,不替代人工审计;部署前核对依赖来源、锁文件与 CI 中的 ${{ secrets.* }} 用法。
  2. 远程控制 / Agent / 文件上传 / 解析外部文档类项目,优先放在内网隔离环境,避免直接暴露公网。
  3. 注意许可证(GPL / AGPL 等)对二次分发与闭源集成的约束。

七、维护约定

  • Gitea 对 is_mirror=1 的仓库禁止 Wiki API / UI 写入(POST .../wiki/pages 返回 405),但读正常;本页由服务端直接维护 <repo>.wiki.git 裸仓。
  • 更新方式:临时 chown -R root:root,用 hash-object -w + mktree + commit-tree + update-ref 提交,最后 chown -R 1000:1000;root 直接 git clone 会触发 dubious ownership。
  • Wiki 是独立裸仓,8 小时 mirror-sync --prune 只操作主裸仓,不会影响本页;删除并重建仓库会连带删除 Wiki,Gitea 迁移/备份时须单独带上 .wiki.git。
  • 每次人工发起的镜像同步完成后,按 gitea-mirror-wiki 技能更新本页;后台自动同步不重复生成。