让 27B 语言模型帮你理解需求、写提示词,再自动切换到图像模型出图。单卡 12 GB 显存 + 16 GB 内存,Windows 本地运行。
A local prompt-to-image workflow for Windows: a 27B language model interprets your request, then hands the GPU to an image model. Built around 12 GB VRAM and 16 GB RAM.
开始部署 / Setup · 实测与耗时 / Measurements · 完整技术指南 / Technical guide · 反馈 / Issues
已有流程样张:输入创作需求 → Qwen3.8-27B 写提示词 → Qwen-Image 2.1 出图。点击查看原图。 Existing pipeline output: creative brief → Qwen3.8-27B prompt → Qwen-Image 2.1 render. Click for the original.
语言模型:Unsloth 发布的 Qwen3.8-27B UD-Q4_K_S GGUF(基座记录为 Qwen/Qwen3.8-27B,量化仓库 unsloth/Qwen3.8-27B-GGUF);图像模型:Comfy-Org/Qwen-Image-2.1,Turbo INT8 convrot DiT + Qwen3-VL-8B INT8 convrot 文本编码器 + BF16 VAE。下面列出实际使用的全部五个文件,而不只写模型系列名。
Exact stack: the Unsloth Qwen3.8-27B UD-Q4_K_S GGUF and its F16 vision projector feed llama.cpp; ComfyUI runs the Qwen-Image 2.1 Turbo INT8 convrot DiT, Qwen3-VL-8B INT8 convrot text encoder and BF16 VAE. These names identify the artifacts recorded in the repository manifest, not an arbitrary compatible substitute.
| 角色 / Role | 确切模型或组件 / Exact model or component | 文件名 / Artifact |
|---|---|---|
| 语言模型 / LLM | Qwen3.8-27B,Unsloth UD-Q4_K_S GGUF | Qwen3.8-27B-UD-Q4_K_S.gguf |
| 配套视觉投影器 / Vision projector | Qwen3.8-27B F16 mmproj,qwen3vl_merger,CPU 运行 |
mmproj-F16.gguf |
| 图像扩散主体 / Image DiT | Qwen-Image 2.1 Turbo INT8 convrot | qwen_image_2.1_turbo_int8_convrot.safetensors |
| 图像侧文本编码器 / Image text encoder | Qwen3-VL-8B INT8 convrot | qwen3vl_8b_int8_convrot.safetensors |
| 图像解码器 / Image VAE | Qwen-Image 2.1 BF16 VAE | qwen_image_2.1_vae_bf16.safetensors |
模型来源、GGUF 元数据、字节数和完整 SHA-256 见模型身份清单。名称和文件名必须与哈希一起核对;更换量化档位或模型后需要重新测量。27B 语言模型不能替代图像侧的 8B 文本编码器;可选的非 Turbo DiT 不属于这里的默认实测集合。
Verify names and hashes against the manifest. A different quantisation or model requires new measurements. The 27B LLM is not interchangeable with the image stack's 8B text encoder; the optional non-Turbo DiT is outside this default stack.
执行顺序 / Execution: Qwen3.8-27B UD-Q4_K_S + F16 mmproj → llama.cpp 理解需求、生成提示词 → 终止 LLM、释放显存 → ComfyUI / Qwen-Image 2.1 Turbo INT8 convrot(8B 编码器 + BF16 VAE)出图 → 终止 ComfyUI、回装 LLM。Low-VRAM local inference uses serial execution, CPU/GPU layer offloading, memory-mapped weights (mmap), and quantized KV cache; the models do not run concurrently.
面向愿意配置本地模型的个人创作者、本地 AI 爱好者,以及想研究小内存部署的开发者。尤其适合:已有 12 GB 级 NVIDIA 显卡、16 GB 内存,暂时不升级硬件,希望把“写提示词、看参考图、生成图片”接起来,并能接受数分钟等待的人。
For creators and local-AI enthusiasts comfortable configuring models, and developers studying memory-constrained deployment. You want one workflow for prompt writing, reference images and rendering on existing hardware, and can accept minutes of waiting.
| 你遇到的问题 / Pain point | 这里提供的做法 / What the project provides |
|---|---|
| 两个模型争抢显存 / Two models compete for VRAM | 总控台依次启动、停止 LLM 与 ComfyUI,完成后回装 LLM / The console sequences LLM and ComfyUI processes, then reloads the LLM |
| 每张图都要写英文提示词、复制粘贴、手动切换 / Manual prompts, copying and switching | 一次提交需求,自动写提示词、切换、出图并保存到桌面 / One request drives prompt authoring, switching and saving the image |
| 想按参考图改图 / Want to work from a reference | 图片同时用于 LLM 理解和图像模型条件生成 / The reference reaches both the vision-capable LLM and image conditioning |
| 显存之外,16 GB 内存也吃紧 / RAM is constrained too | 提供按层卸载、可回收 mmap 页、量化 KV 的配置与账本 / Documented layer offload, reclaimable mmap pages and quantised KV configuration |
| 你可能在找 / You may be looking for | 对应术语 / Technical terms | 适用范围 / Fit |
|---|---|---|
| 12GB 显卡、16GB 内存,本地跑大模型和生图 / Local LLM and image generation on 12GB VRAM, 16GB RAM | low VRAM; local AI; GGUF; CPU/GPU offloading | 针对已有参考机配置的串行流程;性能不保证跨机器通用 / Serial workflow for the recorded configuration, not a universal performance guarantee |
| 让大模型写提示词,再交给 ComfyUI / LLM prompt generation for ComfyUI | llama.cpp; ComfyUI; automatic model switching; prompt-to-image | 总控台生成提示词、停止 LLM、启动图像后端,再回装 / Console sequences prompt generation, shutdown, rendering and reload |
| 上传参考图,换风格或重绘 / Reference-image editing and image-to-image generation | Qwen-Image; image editing; reference conditioning | 参考图进入视觉模型和图像条件编码器;不保证像素或身份保真 / Reference reaches both models; no pixel or identity preservation guarantee |
| 部署后离线生成图片 / Offline text-to-image on Windows | offline AI; local inference; Windows; text-to-image | 权重和运行时首次下载需联网,部署后本地推理 / Initial downloads require network; inference is local after setup |
| 内存不够,想查 GGUF 卸载和 mmap 配置 / Memory-constrained GGUF deployment | model offloading; mmap; quantized KV cache; out-of-memory | 可查看卸载账本与 OOM 记录;不是通用内存优化库 / Offload and OOM evidence, not a general memory-optimisation library |
按需求核对能力、证据和限制 / Use-case evidence and limits
- 一条完整的本地链路。 从自然语言需求到图片,模型切换由总控台处理;部署后推理在本机完成。A complete local workflow, with automatic model switching after setup.
- 同时考虑显存与系统内存。 卸载账本和实测记录解释张量放在哪里、哪些页可回收,以及哪些参数曾导致 OOM。The offload ledger and measurements explain where memory goes and which configurations failed.
- 可选参考图与思考档位。 支持文生图、参考图重绘及五档推理强度请求;档位不是画质保证。Supports text-to-image, reference-guided generation and five reasoning settings; higher settings do not guarantee better images.
- 另有纯对话入口。 不出图时可使用独立聊天界面。两个入口共享后端,建议一次只用一个。A separate chat interface is included; use one console at a time because they share a backend.
需求 / Brief (+ optional reference image)
→ LLM 理解并写提示词 / interpret and write prompt
→ 停止 LLM,释放显存 / stop LLM
→ ComfyUI 生成并保存图片 / render and save
→ 停止 ComfyUI,回装 LLM / stop ComfyUI and reload LLM
| 参考图重绘 / Reference-guided redraw | 文生图 / Text-to-image |
|---|---|
![]() |
![]() |
| 把上面的鳄鱼改成水彩风格 / Re-render the crocodile in watercolour | 橘猫坐在窗台上晒太阳 / A ginger cat in a sunny window |
以下来自仓库已有的参考机记录,不是本次文档更新重新测得,也不是所有 12 GB 显卡的性能保证。设备记录为 RTX 3060 Laptop GPU(12288 MiB)、i5-9400F、15.94 GiB RAM;请以实际显存容量核对配置,不要仅按显卡名称判断。完整条件见 EVIDENCE 和 模型清单。
These are existing reference-machine records, not new benchmarks or guarantees for every 12 GB card. Check actual VRAM capacity and the exact model files, not just the GPU name.
| 项目 / Item | 已记录结果 / Recorded result |
|---|---|
| LLM 生成 / Generation | 约 / about 4 tok/s,SSD 热态 / warm SSD |
| LLM 配置测量点 / Measured configuration | 64,000 context、-ngl 44;显存 11,552 MiB,系统内存 96.1% |
| 1080p 出图段 / Render stage | 1920×1088,约 / about 88 s,不含切换 / excludes switching |
| 2K 出图段 / Render stage | 2560×1440,约 / about 4.5 min,不含切换 / excludes switching |
| 一次带参考图的完整流程 / One reference-image run | 6 min 41 s,包含最终回装 LLM;图片在 5 min 24 s 时生成 / includes final LLM reload; image written at 5 min 24 s — 时间线 / timeline |
历史运行环境记录:Windows 11 build 26200、驱动 616.92、llama.cpp 0.6.0-dev / build 11617 / commit 14310190c、ComfyUI 0.41.0、PyTorch 2.14.0+cu130、嵌入式 Python 3.13.14。硬件和完整版本表见模型与环境清单。SSD 上的热态结果不能与 HDD 冷加载直接比较。
| 侧 / Component | 需要记录并保持一致的参数 / Configuration to record |
|---|---|
| llama.cpp | -ngl 44 -c 65536 -np 1 -ctk q4_0 -ctv q4_0 -fa on -ub 256 -lm mmap;LLAMA_ARG_MMPROJ_OFFLOAD=0;不使用 -ncffn 或 mlock |
| 提示词生成 / Prompt generation | 默认 QWEN_THINKING=off;max_tokens=2000、temperature=0.7;切换思考档位需要重启 LLM |
| ComfyUI | --fast-disk --disable-pinned-memory --windows-standalone-build |
| 默认图像采样 / Image sampling | Turbo,8 steps,Euler,simple scheduler,CFG 1.0,denoise 1.0;每次 seed 由当前时间生成,必须从日志记录 |
| 输出 / Output | 无参考图:1080p = 1920×1088,2K = 2560×1440;有参考图:按参考图长宽比生成,不能仅凭模式名认定尺寸 |
64,000 与 65,536 分开记录: 上表实测显存/内存对应的上下文测量点是 64,000;仓库当前启动器默认是 65,536。运行默认值不能当作精确复现了 64,000 的那一行。出图总控台的 context/ngl 在源码中固定,QWEN_CTX/QWEN_NGL 只覆盖纯对话入口,详见路径与参数边界。
The recorded memory row uses 64,000, while the shipped launcher uses 65,536. Record the actual configuration; do not label a default run as an exact repeat of the memory measurement. Runtime settings above are inspectable in the orchestrator and workflow template.
下面是针对当前仓库的复现步骤,不是声称历史所有样本都按这一完整协议测过。历史吞吐及出图汇总没有完整记录每次输入、seed、重复次数或方差,因此是参考观测值,不是统计基准。
This is a procedure for new reproduction runs. Historical summaries do not preserve every input, seed, repeat count or variance; they are reference observations, not a statistical benchmark.
- 完成部署并固定测试条件。 按完整安装映射获取上述五份权重及运行时,核对路径、工作目录、版本、页面文件和磁盘空间。记录 GPU 实际显存、RAM、驱动、SSD/HDD、后台负载及冷/热态;测试时一次只使用一个总控台,避免共享后端被另一入口停止。
- 逐文件核对身份。 对五个实际运行文件执行下面的 PowerShell 命令,把长度和完整 SHA-256 与 MODELS.md 逐项比较。变量
$modelPath是你已部署文件的实际绝对路径,依次替换为五个文件;不能只核对文件名。
# Repeat for each of the five deployed model artifacts, using its actual path. $modelPath = 'C:\llm\models\Qwen3.8-27B\Qwen3.8-27B-UD-Q4_K_S.gguf' Get-Item -LiteralPath $modelPath | Select-Object Name, Length Get-FileHash -LiteralPath $modelPath -Algorithm SHA256
- 启动资源采样,再启动 UI。 在独立终端运行下面的 GPU 采样命令,每秒记录总显存占用和 GPU 利用率,测试后用 Ctrl+C 停止。另用任务管理器记录系统物理内存基线、LLM 阶段和图像阶段的读数;记录采样时间。设备总显存包含桌面与其他进程,不等于模型张量字节数;低频采样也不保证捕获瞬时峰值。
# Separate terminal; keep the resulting file outside the repository. nvidia-smi --query-gpu=timestamp,name,memory.total,memory.used,utilization.gpu --format=csv -l 1 > "$env:TEMP\qwen-gpu-samples.csv"
# Repository root, after deployment/path checks. Use the UI for the timed run. $env:QWEN_THINKING = 'off' node .\orchestrator\orchestrator.mjs # Open http://127.0.0.1:8090 and wait until the LLM is ready.
- 逐项测试,保存确切输入。 先做无参考图的 1080p 文生图,例如“橘猫坐在窗台上晒太阳,水彩风格”;再以相同需求测试 2K;最后上传一张本地图并给出明确修改指令,测试参考图链路。逐项记录提示原文、思考档位、原始参考图 SHA-256、模式、实际输出尺寸、生成的英文提示词、图像 seed 和结果文件。示例需求只是新测试输入,不冒充历史 88 秒或 4.5 分钟样本的原始输入。测试前后核对 UI 所选思考档位;不把
--mode当作参考图输出尺寸保证。 - 按阶段读日志与计时。 用 UI 提交后,取
logs/orchestrator.log中的“流程开始”为起点、“出图完成”为图片可用终点、“Qwen3.8 就绪 / 流程结束”为回装完成终点。分别统计提示词生成、LLM 停止、ComfyUI 启动/就绪、出图、ComfyUI 停止和 LLM 回装;启动 UI 前的冷启动另记,不混进既有时间线。总控台日志时间为 UTC;后端日志按各自格式记录,跨日期时保留日期与外部计时记录。日志目录默认C:\ComfyUI\logs,或QWEN_COMFY_ROOT下的logs;还需保存orchestrator-llama.log、orchestrator-comfy.log和last_prompt.txt。 - 单独计算各项结果。 从 llama.cpp 的生成阶段 timing(排除 prompt evaluation)报告 tok/s,并保留原日志;只有在明确生成 token 数和生成耗时时才自行相除。RAM 记录系统物理内存百分比,显存区分设备总占用与 llama.cpp 自报缓冲。不要用 GGUF 文件体积、进程提交内存或 mmap 映射大小代替物理 RAM。检查输出图能打开、尺寸正确,模型切换和最终回装确实完成;失败、超时和 OOM 也必须记录。
- 重复并报告范围。 若要形成自己的基准,建议每种模式重复至少 3 次,保留冷启动样本和后续热态样本,分别报告原始结果、中位数和范围,并写清样本量。由于 LLM 采样与时间 seed,重复不保证同图;当前 CLI 没有固定 seed 参数。发布前移除私人路径、提示词和参考图。上述次数是建议方案,不能写成仓库历史已经完成的重复次数。
计时示例只对应已有那一次带参考图运行: 提示词 217 s → 停 LLM 5 s → ComfyUI 就绪 22 s → 出图 80 s → 停 ComfyUI 6 s → 回装 71 s,合计 401 s;到图片生成是 324 s。这一轮的图像段 80 s 与汇总表约 88 s 是不同观测,不应强行合并;原始输入和思考设置不足以从公开摘录完整还原该轮。参见带时间戳的日志摘录。
复现报告至少包含 / Minimum report: commit、五份模型哈希、硬件/运行时版本、实际参数、冷/热态、任务与参考图标识、seed、输出尺寸、各阶段耗时、tok/s 来源、GPU/RAM 采样及失败信息。For each new run, retain enough evidence to separate prompt generation, rendering, switching and final reload. The historical 401 s run is a single observation, not a promise for new inputs.
仓库还提供按程序阻断出站的验证步骤:核对实际推理程序路径 → 用 tools/fw-on.ps1 添加并回读规则 → 完整运行提示词生成和出图 → 用 tools/fw-off.ps1 清理并确认删除,失败时也须清理。两个脚本需要管理员权限。此方法只覆盖指定的推理进程,Node.js 不在默认阻断范围内;它不是全机断网测试,也没有附日期化的历史验证结果。
部署前须知 / Before setup: 严格串行;内存余量很小;首次部署要下载约 31.3 GiB 权重,建议准备 100 GiB 以上可用磁盘空间(含页面文件及安装余量)。参考图不保证主体细节保真;64K 配置不等于满上下文压力测试。当前仍有参考机绝对路径需要核对,并非克隆后即可运行的一键安装包。
Strictly serial; little spare RAM. Weights total about 31.3 GiB; budget 100 GiB or more free disk space including pagefile and setup headroom. Reference-guided generation does not guarantee identity preservation. The 64K configuration is not a full-context stress test. Some reference-machine paths still need manual adjustment: this is not a one-click installer.
需要 Windows、12 GB 级 NVIDIA GPU、16 GB RAM、SSD、PowerShell 7、Node.js,以及独立获取的 llama.cpp、ComfyUI 和配套权重。Windows 11 有参考机记录;其他配置需要自行验证。
Requires Windows, a 12 GB-class NVIDIA GPU, 16 GB RAM, SSD, PowerShell 7, Node.js, and separately obtained runtimes and weights. The recorded reference system uses Windows 11; validate other configurations yourself.
- 先核对模型。 查看文件名、哈希与版本。Check exact models, hashes and runtime versions.
- 按完整指南部署。 快速开始与路径映射列出权重来源、目录布局、环境变量及仍然写死的路径。Follow the setup and path mapping, including the hard-coded paths that environment overrides do not cover.
- 配置完成后再启动。 从仓库根目录运行下面的出图入口;纯对话入口及 CLI 示例见完整指南。Once setup is complete, launch the image console from the repository root:
git clone https://github.com/Jxbbbbbyan/qwen-duo-12g.git cd qwen-duo-12g # Complete the linked setup and path mapping before the next command. node .\orchestrator\orchestrator.mjs # Open http://127.0.0.1:8090
首次尝试可输入“橘猫坐在窗台上晒太阳,水彩风格”。这是建议的试用任务,不是固定输出或速度承诺。 Try “a ginger cat on a sunny windowsill, watercolour style”; outputs and timing vary.
完整技术指南 · 模型清单 · 内存账本 · 运行时间线 · OOM 排查记录
欢迎在 Issues 分享复现结果:GPU 实际显存、系统内存、模型哈希、参数、各阶段耗时,以及成功或失败的日志。请先移除私人路径、提示词和图片。其他机器的复现,比单纯增加功能更有助于确认适用范围。
Share reproduction reports with actual VRAM, RAM, model hashes, flags, stage timings and redacted logs. Reports from other machines help establish the supported envelope. If this workflow is useful to you, a star helps you find it again.
MIT covers this repository's original code and documentation. Model weights retain their own upstream licences.


