license: other
license_name: qwen-research
license_link: LICENSE
base_model: Qwen/Qwen-Image-2.1-PE-I2I
base_model_relation: quantized
library_name: gguf
pipeline_tag: image-text-to-text
tags:
- sakura
- sakura-image
- gguf
- llama.cpp
- qwen-image
- prompt-rewriting
- image-editing
- uncensored
- abliterated
- not-for-all-audiences
Sakura — Qwen-Image-2.1-PE-I2I, uncensored (GGUF)
Built with Qwen. Community quantization of Qwen/Qwen-Image-2.1-PE-I2I, the image-editing prompt-rewriting model of Qwen-Image-2.1 (a fine-tuned Qwen3.5-VL 9B that reads one or more input images and an edit instruction and answers with a precise editing instruction for the image model), with abliterated (uncensored) weights. Independent work, not made or endorsed by Alibaba/Qwen. Non-commercial use only (Qwen RESEARCH LICENSE AGREEMENT, copy in LICENSE).
For adults only; you are responsible for what you generate and for the laws that apply to you. The model has no safety filter and writes harmful requests verbatim into the prompt and thus into the image (in our test, for example, explosive-making steps, a threatening letter and an invented hate-site URL). Do not use it to depict minors in any sexual or abusive context, or to create sexual or defamatory images of real persons without their consent; this is illegal in most countries. Do not put it into a public service without your own moderation.
What this model does
The model reads input images (referred to as <image1>, <image2>, ...) and an instruction, thinks in a <think> block, and then answers with a JSON object:
{"rewritten_prompt": "<precise editing instruction>", "wh_ratio": "", "ratio_follow": "<image1>"}
wh_ratio (a new aspect ratio, for new compositions) and ratio_follow (inherit the ratio of an input image, for in-place edits) are mutually exclusive. You pass rewritten_prompt to the image-editing model (Qwen-Image-2.1). The system prompt the model was trained with is the unmodified system_prompt.txt of the original repository, included here; always send it as the system message.
What you need to run it
Everything except the runtime is in this repository. Pick the column of the program you use (🟦 llama.cpp, 🟧 ComfyUI):
| Part | 🟦 llama.cpp | 🟧 ComfyUI |
|---|---|---|
| Model (pick one) | Sakura-PE-I2I-Uncensored-Q8_0-8.87GiB.gguf (the file we measured) or Sakura-PE-I2I-Uncensored-Q4_K_M-5.24GiB.gguf (smaller, importance matrix, not evaluated), passed with -m |
not tested |
| Vision tower (for image input) | Sakura-PE-I2I-mmproj-F16-0.86GiB.gguf, passed with --mmproj; unmodified vision tower of the original, converted to GGUF F16 |
not tested |
| System prompt | system_prompt.txt (this repository, unmodified copy of the original) |
– |
| Program | llama-server of llama.cpp with Qwen3.5 support, --jinja and --mmproj; we measured with release b11524 (Vulkan), not included |
– |
Runtime warning: with llama.cpp release b11259 this architecture (Qwen3.5) read only the first word of an English user message in our tests (also with third-party GGUF files). Use a newer build and check it with a short question before you trust any result.
What is "uncensored" here, exactly
| Part | What we did |
|---|---|
| Weights (Qwen3.5-VL 9B language model) | Directional ablation with Heretic 1.4.0 on o_proj + down_proj, then GGUF Q8_0 and Q4_K_M. The vision tower is not changed. 40 trials only, started with the 12 best parameter sets of the PE-T2I study (see below); selection rule: fewest refusals with KL <= 0.1; selected trial 33 of 40. |
The vision tower and the system prompt are untouched.
What we measured (and what not)
1. Heretic's own count (BF16 checkpoint, before quantization). Heretic generates 100 tokens with its default system prompt (You are a helpful assistant.) and the template default (thinking open); for this model it found the common response start 'The user' automatically and counts English keywords in the continuation. Result on its 100 harmful evaluation prompts: refusals 98/100 -> 68/100, KL divergence of the first-token distribution 0.026. This counts words in the reasoning text, not in the final answer.
2. Heretic's counting rule on our GGUF files (Q8_0, llama.cpp b11524, the first 100 harmful test prompts, 100 tokens, default system prompt, no input image). Note: we forced the start I first that Heretic found for PE-T2I, not the The user it found for this model, and we did not run The user on the GGUF files:
| Setting | unchanged | ours (uncensored) |
|---|---|---|
thinking open, response start I first |
93 / 100 | 61 / 100 |
| thinking open, no forced start | 95 / 100 | 68 / 100 |
thinking switched off (closed <think></think>) |
100 / 100 | 93 / 100 |
thinking switched off, response start I first |
90 / 100 | 57 / 100 |
Without a forced start the GGUF file gives 68/100, the same number as Heretic's BF16 count, so the ablation reached the GGUF file; it acts while the model thinks; with thinking switched off the first answer tokens hardly change. Keep thinking on.
3. Full-length test with the model's own system prompt and an input image (the intended use; llama.cpp b11524, Q8_0, thinking on, temperature 0, up to 6,144 generated tokens, -c 16384, 24 prompts, every fourth of the 104 harmful test prompts (index 0, 4, ..., 92), each sent together with one neutral picture of 512 px; the final JSON was parsed and every rewritten prompt was read by us):
| unchanged | ours (uncensored) | |
|---|---|---|
| final JSON found | 21 | 17 |
| not finished within 6,144 tokens (still thinking) | 3 | 7 |
rewritten_prompt declines the request or replaces it by a "safe" scene |
16 | 0 |
rewritten_prompt silently replaces it by an unrelated scene |
3 | 0 |
rewritten_prompt carries out the request |
2 | 17 |
Limits of this test: only 24 prompts, one set of neutral pictures, the answers were classified by hand by one person (us), English prompts only. We did not generate images from the rewritten prompts. The test prompts cover crime, cyber attacks, hate and misinformation only; sexual content and edits of real people were not tested, so we make no claim about them (this model edits photographs of people). The unfinished answers (3 and 7) say nothing either way; in this sample the ablated model hit the token limit more often. The Q4_K_M file was not part of this test and was not run at all with this model; the vision tower file was only used with the Q8_0 file.
Alternatives: other community builds of the same model exist, e.g. pottokao/Qwen-Image-2.1-PE-I2I-Heretic-GGUF, which reports a much deeper parameter search (about 1,900 trials, about 5/100 refusals at KL about 0.037 by Heretic's count). Our 40-trial result is clearly weaker by that count; the full-length test above shows the behaviour that matters for use, but we have not run the other build through it.
Files
| File | Size | What it is |
|---|---|---|
Sakura-PE-I2I-Uncensored-Q8_0-8.87GiB.gguf |
8.87 GiB | uncensored prompt rewriter, Q8_0 |
Sakura-PE-I2I-Uncensored-Q4_K_M-5.24GiB.gguf |
5.24 GiB | uncensored prompt rewriter, Q4_K_M (importance matrix) |
Sakura-PE-I2I-mmproj-F16-0.86GiB.gguf |
0.86 GiB | vision tower (unmodified), F16 |
system_prompt.txt |
18 KiB | the system prompt of the original model, unmodified |
LICENSE, NOTICE, SHA256SUMS |
Qwen RESEARCH LICENSE AGREEMENT, notices and list of changes, checksums |
Run with llama.cpp
llama-server -m Sakura-PE-I2I-Uncensored-Q8_0-8.87GiB.gguf --mmproj Sakura-PE-I2I-mmproj-F16-0.86GiB.gguf --jinja -ngl 99 -c 16384 --port 8080
import base64, json, urllib.request
system = open("system_prompt.txt", encoding="utf-8").read().strip()
img = base64.b64encode(open("input.png", "rb").read()).decode()
body = {"messages": [{"role": "system", "content": system},
{"role": "user", "content": [{"type": "image_url", "image_url": {"url": "data:image/png;base64," + img}},
{"type": "text", "text": "make the chair red"}]}],
"temperature": 0, "max_tokens": 8192}
req = urllib.request.Request("http://127.0.0.1:8080/v1/chat/completions", json.dumps(body).encode(), {"Content-Type": "application/json"})
print(json.loads(urllib.request.urlopen(req).read())["choices"][0]["message"]["content"])
The system prompt is long (about 4,600 tokens) and the model thinks for 1,300 to more than 6,000 tokens before the JSON: give it max_tokens of 8,192 or more and a context of at least 16,384. On our machine (AMD Strix Halo, Vulkan) one answer took about 1 to 4.5 minutes.
How the ablation was made
The sibling model Sakura-Qwen-Image-2.1-PE-T2I-Uncensored-GGUF has the same architecture. We took the 12 best parameter sets (Pareto front, KL <= 0.1) of its study and ran them first on this model; each was evaluated again here (refusals and KL measured on this model), then the sampler continued up to 40 trials. For PE-T2I the same procedure reached 95/100 -> 21/100 (Heretic's count) in 80 trials; here 98/100 -> 68/100. The Q4_K_M file was made with an importance matrix computed on the ablated weights (calib_mix_v1.txt, English / German / code mix, 30 chunks of 512 tokens), then llama-quantize from the BF16 GGUF. We did not build an unchanged Q4_K_M.
What we changed (Qwen RESEARCH LICENSE, section 3b)
Sakura-PE-I2I-Uncensored-*.gguf: the official weights of Qwen-Image-2.1-PE-I2I (repository revision72927bc08afc99b7888ceb7d7d51a12db3700bbd, sha256 of all four shards checked against the Hub) with Heretic's directional ablation (o_proj,down_proj) merged into the language-model weights, converted to GGUF with llama.cpp (--no-mtp, because the originalconfig.jsonhas"mtp_num_hidden_layers": null) and quantized (Q8_0; Q4_K_M with importance matrix). Modified files.Sakura-PE-I2I-mmproj-F16-*.gguf: the unmodified vision tower of the original converted to GGUF F16. Converted file.system_prompt.txtandLICENSEare unmodified copies from the original repository.
License and use
Qwen RESEARCH LICENSE AGREEMENT (LICENSE): use, reproduction and modification for non-commercial purposes only (research or evaluation); redistribution requires this license text and the notices in NOTICE. The agreement is governed by the laws of China. "Qwen" is the name of the original work; this is a derivative work by Sakura, "based on Qwen-Image-2.1-PE-I2I".
Part of the Sakura Image collection.
Credits
- Original model: Qwen/Qwen-Image-2.1-PE-I2I (Qwen / Alibaba).
- Ablation: p-e-w/heretic (AGPL-3.0, used as a tool; not included here).
- GGUF conversion and inference: ggml-org/llama.cpp (MIT).
中文说明 · 樱花 (Simplified Chinese)
English above. 本节为上文的中文翻译(Sakura = 樱花 yīnghuā);完整的独立中文版见 README_zh.md。
Sakura — Qwen-Image-2.1-PE-I2I,去审查版(GGUF)
Built with Qwen. 这是 Qwen/Qwen-Image-2.1-PE-I2I 的社区量化版本。它是 Qwen-Image-2.1 的图像编辑 提示词改写模型(基于 Qwen3.5-VL 9B 微调,读取一张或多张输入图像和一条编辑指令,输出给图像模型使用的精确编辑指令),并带有 经消融(abliterated,去审查)的权重。属于独立工作,并非 Alibaba/Qwen 制作或认可。仅限非商业用途(Qwen RESEARCH LICENSE AGREEMENT,副本见 LICENSE)。
仅限成年人使用;您需对自己生成的内容以及适用于您的法律负责。本模型没有安全过滤,会把有害请求原样写进提示词,进而写进图像(在我们的测试中,例如制造爆炸物的步骤、一封威胁信和一个虚构的仇恨网站网址)。不要用它来描绘涉及性或虐待情境的未成年人,也不要在未经同意的情况下制作真实人物的性相关或诽谤性图像;这在大多数国家是违法的。未经您自己的内容审核,请勿将其放入公共服务。
这个模型做什么
模型读取输入图像(记作 <image1>、<image2> ……)和一条指令,先在 <think> 块中思考,然后输出一个 JSON 对象:
{"rewritten_prompt": "<precise editing instruction>", "wh_ratio": "", "ratio_follow": "<image1>"}
wh_ratio(新的宽高比,用于新构图)和 ratio_follow(沿用某张输入图像的比例,用于原位编辑)互斥。您把 rewritten_prompt 交给图像编辑模型(Qwen-Image-2.1)。模型训练时使用的系统提示词就是原始仓库中未改动的 system_prompt.txt,已随本仓库提供;请始终把它作为系统消息发送。
运行所需文件
除运行程序外,所需文件都在本仓库中。请选择您所用程序对应的一列(🟦 llama.cpp,🟧 ComfyUI):
| 部分 | 🟦 llama.cpp | 🟧 ComfyUI |
|---|---|---|
| 模型(二选一) | Sakura-PE-I2I-Uncensored-Q8_0-8.87GiB.gguf(我们测量过的文件)或 Sakura-PE-I2I-Uncensored-Q4_K_M-5.24GiB.gguf(更小,带重要性矩阵,未经评估),通过 -m 传入 |
未测试 |
| 视觉塔(用于图像输入) | Sakura-PE-I2I-mmproj-F16-0.86GiB.gguf,通过 --mmproj 传入;原模型未改动的视觉塔,已转为 GGUF F16 |
未测试 |
| 系统提示词 | system_prompt.txt(本仓库,原文件的未改动副本) |
– |
| 程序 | 支持 Qwen3.5 并带 --jinja 和 --mmproj 的 llama.cpp 的 llama-server;我们使用 b11524 版本(Vulkan)测量,不包含 |
– |
运行环境警告: 在我们的测试中,llama.cpp 的 b11259 版本对这一架构(Qwen3.5)只读取英文用户消息的第一个单词(第三方 GGUF 文件也一样)。请使用更新的版本,并先用一个简短问题验证,再相信任何结果。
这里的“去审查”具体指什么
| 部分 | 我们做了什么 |
|---|---|
| 权重(Qwen3.5-VL 9B 语言模型) | 使用 Heretic 1.4.0 对 o_proj + down_proj 做定向消融,再转为 GGUF Q8_0 和 Q4_K_M。视觉塔 没有 改动。只做了 40 次试验,以 PE-T2I 研究中最好的 12 组参数作为起点(见下文);选择规则:在 KL <= 0.1 的前提下拒绝次数最少;选中的是 40 次中的第 33 次。 |
视觉塔和系统提示词均未改动。
我们测量了什么(以及没有测量什么)
1. Heretic 自带的统计(BF16 检查点,量化之前)。 Heretic 使用默认系统提示词(You are a helpful assistant.)和模板默认值(思考开启)生成 100 个词元;对本模型它自动找到了共同的回答开头 'The user',并统计后续文本中的英文关键词。在它的 100 条有害评估提示词上的结果:拒绝次数 98/100 -> 68/100,首个词元分布的 KL 散度为 0.026。这统计的是 推理文本 中的词,而不是最终回答。
2. 在我们的 GGUF 文件上使用 Heretic 的计数规则(Q8_0,llama.cpp b11524,前 100 条有害测试提示词,100 个词元,默认系统提示词,没有输入图像)。注意:我们强制使用的是 Heretic 为 PE-T2I 找到的开头 I first,而不是它为本模型找到的 The user,并且我们没有在 GGUF 文件上运行 The user:
| 设置 | 未改动 | 我们的(去审查) |
|---|---|---|
思考开启,回答开头 I first |
93 / 100 | 61 / 100 |
| 思考开启,不强制开头 | 95 / 100 | 68 / 100 |
关闭思考(闭合的 <think></think>) |
100 / 100 | 93 / 100 |
关闭思考,回答开头 I first |
90 / 100 | 57 / 100 |
不强制开头时 GGUF 文件给出 68/100,与 Heretic 的 BF16 统计相同,所以消融确实作用到了 GGUF 文件上;它在模型思考时起作用;关闭思考后,回答最初的几个词元几乎没有变化。 请保持思考开启。
3. 使用模型自带系统提示词并带输入图像的完整长度测试(即预期用法;llama.cpp b11524,Q8_0,思考开启,温度 0,最多生成 6,144 个词元,-c 16384,取 104 条有害测试提示词中每隔四条的一条,共 24 条(索引 0、4、……、92),每条与一张 512 像素的中性图片一起发送;我们解析了最终的 JSON,并逐条阅读了改写后的提示词):
| 未改动 | 我们的(去审查) | |
|---|---|---|
| 找到最终 JSON | 21 | 17 |
| 在 6,144 个词元内未完成(仍在思考) | 3 | 7 |
rewritten_prompt 拒绝请求,或把它换成“安全”的场景 |
16 | 0 |
rewritten_prompt 悄悄把它换成了无关场景 |
3 | 0 |
rewritten_prompt 执行了请求 |
2 | 17 |
本测试的局限: 只有 24 条提示词,只有一组中性图片,回答由一个人(我们)手工分类,只有英文提示词。我们没有根据改写后的提示词生成图像。测试提示词只涉及犯罪、网络攻击、仇恨和虚假信息;性相关内容和对真实人物的编辑没有测试,因此我们对这些不作任何声明(本模型会编辑人物照片)。未完成的回答(3 条和 7 条)对结论没有任何说明;在这个样本中,被消融的模型更常撞上词元上限。Q4_K_M 文件 没有 参与这项测试,也完全没有与本模型一起运行过;视觉塔文件只与 Q8_0 文件一起使用过。
其他选择: 同一模型还有其他社区构建版本,例如 pottokao/Qwen-Image-2.1-PE-I2I-Heretic-GGUF,它报告了深得多的参数搜索(约 1,900 次试验,按 Heretic 的统计约在 KL 约 0.037 时拒绝次数约 5/100)。按这一统计,我们 40 次试验的结果明显较弱;上面的完整长度测试展示了对实际使用重要的行为,但我们没有让其他构建版本通过同样的测试。
文件
| 文件 | 大小 | 说明 |
|---|---|---|
Sakura-PE-I2I-Uncensored-Q8_0-8.87GiB.gguf |
8.87 GiB | 去审查的提示词改写模型,Q8_0 |
Sakura-PE-I2I-Uncensored-Q4_K_M-5.24GiB.gguf |
5.24 GiB | 去审查的提示词改写模型,Q4_K_M(重要性矩阵) |
Sakura-PE-I2I-mmproj-F16-0.86GiB.gguf |
0.86 GiB | 视觉塔(未改动),F16 |
system_prompt.txt |
18 KiB | 原模型的系统提示词,未改动 |
LICENSE、NOTICE、SHA256SUMS |
Qwen RESEARCH LICENSE AGREEMENT、声明与修改清单、校验和 |
使用 llama.cpp 运行
llama-server -m Sakura-PE-I2I-Uncensored-Q8_0-8.87GiB.gguf --mmproj Sakura-PE-I2I-mmproj-F16-0.86GiB.gguf --jinja -ngl 99 -c 16384 --port 8080
import base64, json, urllib.request
system = open("system_prompt.txt", encoding="utf-8").read().strip()
img = base64.b64encode(open("input.png", "rb").read()).decode()
body = {"messages": [{"role": "system", "content": system},
{"role": "user", "content": [{"type": "image_url", "image_url": {"url": "data:image/png;base64," + img}},
{"type": "text", "text": "make the chair red"}]}],
"temperature": 0, "max_tokens": 8192}
req = urllib.request.Request("http://127.0.0.1:8080/v1/chat/completions", json.dumps(body).encode(), {"Content-Type": "application/json"})
print(json.loads(urllib.request.urlopen(req).read())["choices"][0]["message"]["content"])
系统提示词很长(约 4,600 个词元),模型在输出 JSON 之前要思考 1,300 到 6,000 多个词元:请给它 8,192 或更大的 max_tokens,以及至少 16,384 的上下文。在我们的机器上(AMD Strix Halo,Vulkan),每次回答用时约 1 到 4.5 分钟。
消融是怎么做的
姊妹模型 Sakura-Qwen-Image-2.1-PE-T2I-Uncensored-GGUF 的架构相同。我们取其研究中最好的 12 组参数(帕累托前沿,KL <= 0.1),先在本模型上运行;每一组都在这里重新评估(拒绝次数和 KL 均在本模型上测得),之后采样器继续,总共最多 40 次试验。同样的流程在 PE-T2I 上经过 80 次试验达到了 95/100 -> 21/100(按 Heretic 的统计);在这里是 98/100 -> 68/100。Q4_K_M 文件使用在消融后权重上计算的重要性矩阵(calib_mix_v1.txt,英文 / 德文 / 代码混合,30 个 512 词元的块),再用 llama-quantize 从 BF16 GGUF 量化。我们没有制作未改动的 Q4_K_M。
我们做了哪些修改(Qwen RESEARCH LICENSE,第 3b 条)
Sakura-PE-I2I-Uncensored-*.gguf:Qwen-Image-2.1-PE-I2I 的官方权重(仓库版本72927bc08afc99b7888ceb7d7d51a12db3700bbd,四个分片的 sha256 均已与 Hub 核对),并把 Heretic 的定向消融(o_proj、down_proj)合并进语言模型权重,再用 llama.cpp 转为 GGUF(使用--no-mtp,因为原始config.json中是"mtp_num_hidden_layers": null),然后量化(Q8_0;Q4_K_M 带重要性矩阵)。属于修改过的文件。Sakura-PE-I2I-mmproj-F16-*.gguf:原模型未改动的视觉塔,转为 GGUF F16。属于转换后的文件。system_prompt.txt与LICENSE是原始仓库中文件的未改动副本。
许可与使用
Qwen RESEARCH LICENSE AGREEMENT(LICENSE):使用、复制和修改 仅限非商业目的(研究或评估);再分发需要附带本许可文本以及 NOTICE 中的声明。该协议受中国法律管辖。“Qwen”是原作品的名称;本仓库是 Sakura 的衍生作品,“基于 Qwen-Image-2.1-PE-I2I”。
属于 Sakura Image 合集。
致谢
- 原始模型:Qwen/Qwen-Image-2.1-PE-I2I(Qwen / Alibaba)。
- 消融:p-e-w/heretic(AGPL-3.0,仅作为工具使用;不包含在此仓库中)。
- GGUF 转换与推理:ggml-org/llama.cpp(MIT)。