diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..64cb1202cb7c9d1f6868415ab336dca0c3407c1d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,24 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +docs/assets/pipeline.png filter=lfs diff=lfs merge=lfs -text +examples/english_case/input.png filter=lfs diff=lfs merge=lfs -text +examples/english_case/input_boxed.png filter=lfs diff=lfs merge=lfs -text +examples/english_case/meanflow_output.png filter=lfs diff=lfs merge=lfs -text +examples/english_case/meanflow_output_boxed.png filter=lfs diff=lfs merge=lfs -text +examples/english_case/teacher_output.png filter=lfs diff=lfs merge=lfs -text +examples/english_case/teacher_output_boxed.png filter=lfs diff=lfs merge=lfs -text +examples/pipeline_case/input.png filter=lfs diff=lfs merge=lfs -text +examples/pipeline_case/input_boxed.png filter=lfs diff=lfs merge=lfs -text +examples/pipeline_case/input_preview.png filter=lfs diff=lfs merge=lfs -text +examples/pipeline_case/meanflow_output.png filter=lfs diff=lfs merge=lfs -text +examples/pipeline_case/meanflow_output_boxed.png filter=lfs diff=lfs merge=lfs -text +examples/pipeline_case/meanflow_output_preview.png filter=lfs diff=lfs merge=lfs -text +examples/pipeline_case/paper_reference.png filter=lfs diff=lfs merge=lfs -text +examples/pipeline_case/teacher_output.png filter=lfs diff=lfs merge=lfs -text +examples/pipeline_case/teacher_output_boxed.png filter=lfs diff=lfs merge=lfs -text +examples/pipeline_case/teacher_output_preview.png filter=lfs diff=lfs merge=lfs -text +models/PixText-MeanFlow/fonts/AlibabaPuHuiTi-3-55-Regular.ttf filter=lfs diff=lfs merge=lfs -text +models/PixText-MeanFlow/fonts/GoNotoCJKCore-v7.0.ttf filter=lfs diff=lfs merge=lfs -text +models/PixText-Teacher/fonts/AlibabaPuHuiTi-3-55-Regular.ttf filter=lfs diff=lfs merge=lfs -text +models/PixText-Teacher/fonts/GoNotoCJKCore-v7.0.ttf filter=lfs diff=lfs merge=lfs -text diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7c48510ac9cc1115b4be1aa46614b56d9b77c87e --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2026 PixText Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d2269932c2fdbe896aef01677dbde4f59a48ba90 --- /dev/null +++ b/README.md @@ -0,0 +1,177 @@ +
](examples/pipeline_case/input_boxed.png) | [
](examples/pipeline_case/meanflow_output_boxed.png) | [
](examples/pipeline_case/teacher_output_boxed.png) |
+
+Each row pairs two targets; every target shows input, MeanFlow output and Teacher output.
+
+| # | Input | MeanFlow · 4 steps | Teacher · 25 steps | # | Input | MeanFlow · 4 steps | Teacher · 25 steps |
+| --- | --- | --- | --- | --- | --- | --- | --- |
+| 1 喜 |
|
|
| 8 给 |
|
|
|
+| 2 发 |
|
|
| 9 解 |
|
|
|
+| 3 甜 |
|
|
| 10 馋 |
|
|
|
+| 4 初 |
|
|
| 11 满 |
|
|
|
+| 5 恋 |
|
|
| 12 满 |
|
|
|
+| 6 鞭 |
|
|
| 13 畜 |
|
|
|
+| 7 炮 |
|
|
| | | | |
+
+**English tagline repair.** [`examples/english_case`](examples/english_case) repairs three damaged spots in a printed tagline: a broken letter plus two words, leaving the surrounding logo untouched.
+
+| Input | MeanFlow · 4 steps | Teacher · 25 steps |
+| --- | --- | --- |
+| [
](examples/english_case/input_boxed.png) | [
](examples/english_case/meanflow_output_boxed.png) | [
](examples/english_case/teacher_output_boxed.png) |
+
+Each row shows one repaired region: input, MeanFlow output and Teacher output.
+
+| Region | Input | MeanFlow · 4 steps | Teacher · 25 steps |
+| --- | --- | --- | --- |
+| Worldwide |
|
|
|
+| Excellence |
|
|
|
+| Quality |
|
|
|
+
+Both cases use seed 42, and the adjacent JSON files record the reproduction metadata. To reproduce them, run the code from [ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText) with `--model` pointing at the packages in `models/`.
+
+Full-resolution images: [pipeline input](examples/pipeline_case/input.png), [MeanFlow](examples/pipeline_case/meanflow_output.png), [Teacher](examples/pipeline_case/teacher_output.png); [tagline input](examples/english_case/input.png), [MeanFlow](examples/english_case/meanflow_output.png), [Teacher](examples/english_case/teacher_output.png).
+
+## Method
+
+
+
+## Installation
+
+The inference code is at [github.com/ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText). Use Python 3.11 or newer and a CUDA GPU. Install a CUDA build of PyTorch and torchvision appropriate for your machine, then install the package:
+
+```bash
+pip install "git+https://github.com/ATH-MaaS/PixText.git"
+```
+
+Pillow must support RAQM. The system must provide HarfBuzz (`libharfbuzz0` on Debian/Ubuntu). Font files are loaded from the model packages in this directory; no system font installation is required.
+
+## What is in this release
+
+This directory contains both model packages, their fonts, example images and checksums. The inference code lives at [github.com/ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText).
+
+| Path | Contents |
+| --- | --- |
+| `models/PixText-Teacher/` | 25-step teacher weights, configuration, and bundled fonts. |
+| `models/PixText-MeanFlow/` | 4-step MeanFlow weights, configuration, and bundled fonts. |
+| `examples/` | Input and output images for both cases, with reproduction metadata. |
+| `docs/assets/` | Pipeline figure. |
+| `model_index.json` | Model identifiers and weight checksums. |
+| `manifest.sha256` | SHA-256 checksums for every model file, configuration file, and font. |
+
+Verify the release from its root:
+
+```bash
+sha256sum -c manifest.sha256
+```
+
+The benchmark for this model, TextRefinementBench, ships as a separate dataset package with its own card.
+
+## Model packages
+
+Both packages are included under `models/`, laid out as follows:
+
+```text
+models/
+ PixText-Teacher/
+ PixText-MeanFlow/
+ model.safetensors
+ config.json
+ inference_config.json
+ manifest.json
+ README.md
+ fonts/
+ AlibabaPuHuiTi-3-55-Regular.ttf
+ GoNotoCJKCore-v7.0.ttf
+ OFL-GoNoto.txt
+ README.md
+```
+
+Teacher uses the same package layout. [`model_index.json`](model_index.json) lists the model identifiers and weight checksums. `from_pretrained` loads a local directory and checks the files listed in its manifest, including the weights, configuration and fonts. A missing or modified bundled font is reported before weights are loaded. Complete packages can be moved without changing their configuration.
+
+## Python
+
+```python
+from pixtext import PixTextPipeline, TextEdit
+
+pipeline = PixTextPipeline.from_pretrained("models/PixText-MeanFlow")
+result = pipeline.edit(
+ "input.png",
+ edits=[TextEdit(bbox=(120, 80, 160, 125), text="鹿")],
+ seed=42,
+)
+result.image.save("output.png")
+```
+
+Use `models/PixText-Teacher` to load Teacher. Both variants can coexist in one process. Results contain `image` and `metadata`, including model identity, seed, sample identity, sampling settings, and crop geometry.
+
+## Command line
+
+Create `edits.json`:
+
+```json
+[{"bbox": [120, 80, 160, 125], "text": "鹿"}]
+```
+
+```bash
+pixtext --model models/PixText-MeanFlow \
+ --image input.png --edits edits.json --output output.png --seed 42
+```
+
+The CLI saves a PNG and a matching JSON metadata file. `python -m pixtext` provides the same command. `--steps` and `--guidance-scale` override the package defaults.
+
+## Batch editing
+
+```python
+results = pipeline.edit_batch(
+ ["first.png", "second.png"],
+ [
+ [TextEdit((120, 80, 160, 125), "鹿")],
+ [TextEdit((20, 30, 100, 70), "PixText")],
+ ],
+ seeds=[42, 43],
+ sample_ids=["first", "second"],
+)
+```
+
+## Inputs and pixel preservation
+
+- Inputs are Pillow images or local image paths, converted to upright RGB using EXIF orientation. Coordinates refer to that upright image.
+- Boxes use original-image pixel coordinates `(x0, y0, x1, y1)` and half-open intervals. Invalid or out-of-image boxes are rejected.
+- Supply one character or a text line per target.
+- Crops align to 16-pixel patches. Pixels outside those footprints remain identical to the original RGB image.
+- Arbitrary image dimensions are supported.
+- Targets are processed in input order, up to 12 per pass. For overlapping aligned crops, the last target written wins. An empty edit list returns the original RGB image.
+- The renderer selects the first bundled font covering the entire target string, using PuHuiTi then Go Noto. Unsupported text produces a coverage error instead of missing-glyph squares.
+- Editing requires CUDA FlexAttention.
+
+Glyph-present and glyph-absent predictions provide guidance on the open interval `(0.1, 1.0)`. At the default guidance setting, four MeanFlow updates use seven model forwards. Initial execution also includes compilation overhead.
+
+## License
+
+Model weights and documentation are released under the Apache License 2.0; see [LICENSE](LICENSE). The inference code is at [ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText). Bundled fonts keep their own terms, described in each model package's `fonts/` directory.
diff --git a/README.zh-CN.md b/README.zh-CN.md
new file mode 100644
index 0000000000000000000000000000000000000000..61875ba1ff47f296f814981778a6550044780166
--- /dev/null
+++ b/README.zh-CN.md
@@ -0,0 +1,177 @@
+
](examples/pipeline_case/input_boxed.png) | [
](examples/pipeline_case/meanflow_output_boxed.png) | [
](examples/pipeline_case/teacher_output_boxed.png) |
+
+每行并排两个目标,每个目标展示输入、MeanFlow 输出与 Teacher 输出。
+
+| # | Input | MeanFlow · 4 steps | Teacher · 25 steps | # | Input | MeanFlow · 4 steps | Teacher · 25 steps |
+| --- | --- | --- | --- | --- | --- | --- | --- |
+| 1 喜 |
|
|
| 8 给 |
|
|
|
+| 2 发 |
|
|
| 9 解 |
|
|
|
+| 3 甜 |
|
|
| 10 馋 |
|
|
|
+| 4 初 |
|
|
| 11 满 |
|
|
|
+| 5 恋 |
|
|
| 12 满 |
|
|
|
+| 6 鞭 |
|
|
| 13 畜 |
|
|
|
+| 7 炮 |
|
|
| | | | |
+
+**英文标语修复。** [`examples/english_case`](examples/english_case) 修复印刷标语中的三处损坏:一个断裂字母和两个单词,周围 logo 保持不变。
+
+| 输入 | MeanFlow · 4 步 | Teacher · 25 步 |
+| --- | --- | --- |
+| [
](examples/english_case/input_boxed.png) | [
](examples/english_case/meanflow_output_boxed.png) | [
](examples/english_case/teacher_output_boxed.png) |
+
+每个修复位置一行:输入、MeanFlow 输出与 Teacher 输出。
+
+| 位置 | 输入 | MeanFlow · 4 步 | Teacher · 25 步 |
+| --- | --- | --- | --- |
+| Worldwide |
|
|
|
+| Excellence |
|
|
|
+| Quality |
|
|
|
+
+两个示例均使用随机种子 42,同目录的 JSON 文件记录复现信息。要复现这些结果,请使用 [ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText) 的代码,并将 `--model` 指向本目录下的模型包。
+
+原始分辨率图片:[pipeline 输入](examples/pipeline_case/input.png)、[MeanFlow 输出](examples/pipeline_case/meanflow_output.png)、[Teacher 输出](examples/pipeline_case/teacher_output.png);[标语输入](examples/english_case/input.png)、[MeanFlow 输出](examples/english_case/meanflow_output.png)、[Teacher 输出](examples/english_case/teacher_output.png)。
+
+## 方法
+
+
+
+## 安装
+
+推理代码位于 [github.com/ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText)。需要 Python 3.11 或更高版本,以及支持 CUDA 的 GPU。先安装适合本机 CUDA 环境的 PyTorch 和 torchvision,再安装该代码包:
+
+```bash
+pip install "git+https://github.com/ATH-MaaS/PixText.git"
+```
+
+Pillow 需要支持 RAQM,系统需要提供 HarfBuzz(Debian/Ubuntu 中为 `libharfbuzz0`)。字体从本目录的模型包加载,无需单独安装到系统。
+
+## 本发布包含什么
+
+本目录包含两个模型包、模型所需字体、示例图片和校验值。推理代码位于 [github.com/ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText)。
+
+| 路径 | 内容 |
+| --- | --- |
+| `models/PixText-Teacher/` | 25 步 Teacher 权重、配置和内置字体。 |
+| `models/PixText-MeanFlow/` | 4 步 MeanFlow 权重、配置和内置字体。 |
+| `examples/` | 两个示例的输入、输出图片和复现元数据。 |
+| `docs/assets/` | 流程图。 |
+| `model_index.json` | 模型标识与权重校验值。 |
+| `manifest.sha256` | 每个模型文件、配置文件和字体的 SHA-256 校验值。 |
+
+在发布根目录执行校验:
+
+```bash
+sha256sum -c manifest.sha256
+```
+
+本模型使用的评测集 TextRefinementBench 作为独立数据集包发布,自带数据卡。
+
+## 模型包
+
+两个模型包已内置在 `models/` 下,结构如下:
+
+```text
+models/
+ PixText-Teacher/
+ PixText-MeanFlow/
+ model.safetensors
+ config.json
+ inference_config.json
+ manifest.json
+ README.md
+ fonts/
+ AlibabaPuHuiTi-3-55-Regular.ttf
+ GoNotoCJKCore-v7.0.ttf
+ OFL-GoNoto.txt
+ README.md
+```
+
+Teacher 使用相同的模型包结构。[`model_index.json`](model_index.json) 列出了模型标识和权重校验值。`from_pretrained` 从本地目录加载模型,检查清单中列出的权重、配置和字体。字体缺失或被修改时,会在加载权重前报错。完整模型包可以移动位置,无需修改配置。
+
+## Python 接口
+
+```python
+from pixtext import PixTextPipeline, TextEdit
+
+pipeline = PixTextPipeline.from_pretrained("models/PixText-MeanFlow")
+result = pipeline.edit(
+ "input.png",
+ edits=[TextEdit(bbox=(120, 80, 160, 125), text="鹿")],
+ seed=42,
+)
+result.image.save("output.png")
+```
+
+加载 Teacher 时,将路径替换为 `models/PixText-Teacher`。两种模型可以在同一进程中使用。返回结果包含 `image` 和 `metadata`,记录模型标识、随机种子、样本标识、采样设置及裁剪区域。
+
+## 命令行
+
+创建 `edits.json`:
+
+```json
+[{"bbox": [120, 80, 160, 125], "text": "鹿"}]
+```
+
+```bash
+pixtext --model models/PixText-MeanFlow \
+ --image input.png --edits edits.json --output output.png --seed 42
+```
+
+命令行会保存 PNG 图片及同名 JSON 元数据文件,也可以使用 `python -m pixtext` 调用。`--steps` 和 `--guidance-scale` 可覆盖模型包的默认设置。
+
+## 批量编辑
+
+```python
+results = pipeline.edit_batch(
+ ["first.png", "second.png"],
+ [
+ [TextEdit((120, 80, 160, 125), "鹿")],
+ [TextEdit((20, 30, 100, 70), "PixText")],
+ ],
+ seeds=[42, 43],
+ sample_ids=["first", "second"],
+)
+```
+
+## 输入与像素保留规则
+
+- 输入可以是 Pillow 图片或本地图片路径,会根据 EXIF 方向转为正向 RGB。编辑坐标以转正后的图片为准。
+- 编辑框使用原图像素坐标 `(x0, y0, x1, y1)`,采用左闭右开的区间。无效或超出图片边界的编辑框会被拒绝。
+- 每个目标可以是一个字符或一行文字。
+- 裁剪区域按 16 像素的 patch 对齐。实际编辑范围之外的像素与原始 RGB 图片完全一致。
+- 支持任意图片尺寸。
+- 按输入顺序处理目标,每轮最多 12 个。对齐后的裁剪区域重叠时,后写入的目标生效。编辑列表为空时返回原始 RGB 图片。
+- 字体按普惠体、Go Noto 的顺序选择,要求单个字体覆盖整条目标文字。不支持的文字会报覆盖错误,不会静默绘制缺字方框。
+- 编辑依赖 CUDA FlexAttention。
+
+字形引导在开区间 `(0.1, 1.0)` 内组合有字形和无字形条件的预测。默认引导设置下,MeanFlow 的 4 次更新需要 7 次模型前向计算。首次执行还包含编译开销。
+
+## 许可
+
+模型权重与文档以 Apache License 2.0 发布,见 [LICENSE](LICENSE)。推理代码位于 [ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText)。内置字体沿用各自条款,详见各模型包的 `fonts/` 目录。
diff --git a/docs/assets/pipeline.png b/docs/assets/pipeline.png
new file mode 100644
index 0000000000000000000000000000000000000000..c482b38dfeb080796d7037244cdb75887b392f36
--- /dev/null
+++ b/docs/assets/pipeline.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bb5cb85019b89811c912f3ca4b6e52e2778d04fb77dcce189a79ead613c56b90
+size 1039521
diff --git a/examples/edits.json b/examples/edits.json
new file mode 100644
index 0000000000000000000000000000000000000000..9d264e3058579f4de2306eb4759f38dafe0a7e99
--- /dev/null
+++ b/examples/edits.json
@@ -0,0 +1,3 @@
+[
+ {"bbox": [120, 80, 160, 125], "text": "鹿"}
+]
diff --git a/examples/english_case/details/e01_input.png b/examples/english_case/details/e01_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..cb0278d0e508a5e85ebce81317130054a9da4b9d
Binary files /dev/null and b/examples/english_case/details/e01_input.png differ
diff --git a/examples/english_case/details/e01_meanflow.png b/examples/english_case/details/e01_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..7bc9bc4969c1789322b5a97d5be9a3f5104f69b3
Binary files /dev/null and b/examples/english_case/details/e01_meanflow.png differ
diff --git a/examples/english_case/details/e01_teacher.png b/examples/english_case/details/e01_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..5a9d5e89b0b60064f204e4556100015ffe02e193
Binary files /dev/null and b/examples/english_case/details/e01_teacher.png differ
diff --git a/examples/english_case/details/e02_input.png b/examples/english_case/details/e02_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..f7d3afe00fddf911b58d8c7f22792623e43311ee
Binary files /dev/null and b/examples/english_case/details/e02_input.png differ
diff --git a/examples/english_case/details/e02_meanflow.png b/examples/english_case/details/e02_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..b8cf96d9193abf3b4ab4406d9a2afc11a7f501be
Binary files /dev/null and b/examples/english_case/details/e02_meanflow.png differ
diff --git a/examples/english_case/details/e02_teacher.png b/examples/english_case/details/e02_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..92ffac76437039a96d106c5f49fdd17baa9f7b4f
Binary files /dev/null and b/examples/english_case/details/e02_teacher.png differ
diff --git a/examples/english_case/details/e03_input.png b/examples/english_case/details/e03_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..cb3598bca60eb01399ed829448d0f599302cc16e
Binary files /dev/null and b/examples/english_case/details/e03_input.png differ
diff --git a/examples/english_case/details/e03_meanflow.png b/examples/english_case/details/e03_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..3f4631cdb11b26f50fc496f5d774a6546be0fe6f
Binary files /dev/null and b/examples/english_case/details/e03_meanflow.png differ
diff --git a/examples/english_case/details/e03_teacher.png b/examples/english_case/details/e03_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..b29a5c8d8c83eb17db558e4839b01e9dfc0771bb
Binary files /dev/null and b/examples/english_case/details/e03_teacher.png differ
diff --git a/examples/english_case/details/excellence_input.png b/examples/english_case/details/excellence_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..70261151a64f6424749815e2f5a1c43cf5d3b0b6
Binary files /dev/null and b/examples/english_case/details/excellence_input.png differ
diff --git a/examples/english_case/details/excellence_meanflow.png b/examples/english_case/details/excellence_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..38c241cbd1dbb9c599aa9943bd48e09a73ea0691
Binary files /dev/null and b/examples/english_case/details/excellence_meanflow.png differ
diff --git a/examples/english_case/details/excellence_teacher.png b/examples/english_case/details/excellence_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..ab2e061b32c9400ec269be66579e4896c85136eb
Binary files /dev/null and b/examples/english_case/details/excellence_teacher.png differ
diff --git a/examples/english_case/details/quality_input.png b/examples/english_case/details/quality_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..85e2f66bb31023fb1e04c920c365e65b78e38e7d
Binary files /dev/null and b/examples/english_case/details/quality_input.png differ
diff --git a/examples/english_case/details/quality_meanflow.png b/examples/english_case/details/quality_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..aeed60fccc7c71df549e7c7784fcdc25980d117d
Binary files /dev/null and b/examples/english_case/details/quality_meanflow.png differ
diff --git a/examples/english_case/details/quality_teacher.png b/examples/english_case/details/quality_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..abd2b845072dbcd5820f11b88d48e6aa8dba08e4
Binary files /dev/null and b/examples/english_case/details/quality_teacher.png differ
diff --git a/examples/english_case/details/worldwide_input.png b/examples/english_case/details/worldwide_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..586368b73e5659d34d1ebeea1e54a44b53c94f0b
Binary files /dev/null and b/examples/english_case/details/worldwide_input.png differ
diff --git a/examples/english_case/details/worldwide_meanflow.png b/examples/english_case/details/worldwide_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..d30224eaaba1f4f1ecd0b02c3d3bba2086a0f4f6
Binary files /dev/null and b/examples/english_case/details/worldwide_meanflow.png differ
diff --git a/examples/english_case/details/worldwide_teacher.png b/examples/english_case/details/worldwide_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..b701b9620af67a929a8f19dbf7b667d7b5dc0c4a
Binary files /dev/null and b/examples/english_case/details/worldwide_teacher.png differ
diff --git a/examples/english_case/edits.json b/examples/english_case/edits.json
new file mode 100644
index 0000000000000000000000000000000000000000..b635c08eca0ffeed8e7bbc4a8e7b3fd817115a36
--- /dev/null
+++ b/examples/english_case/edits.json
@@ -0,0 +1,29 @@
+[
+ {
+ "bbox": [
+ 382,
+ 405,
+ 396,
+ 431
+ ],
+ "text": "d"
+ },
+ {
+ "bbox": [
+ 449,
+ 410,
+ 574,
+ 444
+ ],
+ "text": "Excellence"
+ },
+ {
+ "bbox": [
+ 595,
+ 396,
+ 680,
+ 439
+ ],
+ "text": "Quality"
+ }
+]
diff --git a/examples/english_case/input.png b/examples/english_case/input.png
new file mode 100644
index 0000000000000000000000000000000000000000..77f7dc39fda10d3af2c6b0989d19883dab3775e2
--- /dev/null
+++ b/examples/english_case/input.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8e5bea2f9d3590ea34a9ca4e2c1db94c3f9a5f7c52e1267237ab58ce9953c4e2
+size 856619
diff --git a/examples/english_case/input_boxed.png b/examples/english_case/input_boxed.png
new file mode 100644
index 0000000000000000000000000000000000000000..71007bcdf365636067254d57d7d535fe7222cd45
--- /dev/null
+++ b/examples/english_case/input_boxed.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f34030e4932610b4907c3a1376c8002b68316b235e33ad276f296edb5d145013
+size 871156
diff --git a/examples/english_case/meanflow_output.json b/examples/english_case/meanflow_output.json
new file mode 100644
index 0000000000000000000000000000000000000000..1b99e25fe1f15aa84ee1ee6c7cb430fd0f6475a5
--- /dev/null
+++ b/examples/english_case/meanflow_output.json
@@ -0,0 +1,47 @@
+{
+ "model_id": "PixText-MeanFlow",
+ "variant": "meanflow",
+ "seed": 42,
+ "sample_id": "image",
+ "steps": 4,
+ "guidance_scale": 3.3,
+ "guidance_interval": [
+ 0.1,
+ 1.0
+ ],
+ "precision": "torch.bfloat16",
+ "geometry": [
+ {
+ "offset": 0,
+ "selected_font_indices": [
+ 0,
+ 0,
+ 0
+ ],
+ "reference_size": [
+ 1024,
+ 1024
+ ],
+ "crops": [
+ [
+ 381,
+ 402,
+ 16,
+ 32
+ ],
+ [
+ 448,
+ 403,
+ 128,
+ 48
+ ],
+ [
+ 590,
+ 394,
+ 96,
+ 48
+ ]
+ ]
+ }
+ ]
+}
diff --git a/examples/english_case/meanflow_output.png b/examples/english_case/meanflow_output.png
new file mode 100644
index 0000000000000000000000000000000000000000..17703504438a551b6ef1d7b5ca3f20a399d018f5
--- /dev/null
+++ b/examples/english_case/meanflow_output.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:df501dd47bd1de23fe7555766c1c45fafe1ffc0647fa218f8e5e20375bf90d66
+size 859830
diff --git a/examples/english_case/meanflow_output_boxed.png b/examples/english_case/meanflow_output_boxed.png
new file mode 100644
index 0000000000000000000000000000000000000000..30b5c2790758ce873c0f46bf3ea5584f2e8082bd
--- /dev/null
+++ b/examples/english_case/meanflow_output_boxed.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e44a799f8a83f52434736907a85b704f6d1ee3e2c606cddc8b09ad1ec29d142f
+size 874344
diff --git a/examples/english_case/source.json b/examples/english_case/source.json
new file mode 100644
index 0000000000000000000000000000000000000000..fc341f00e16283bbb4ac86e34b020df0833724c6
--- /dev/null
+++ b/examples/english_case/source.json
@@ -0,0 +1,7 @@
+{
+ "sample_id": "english-tagline",
+ "source_image_sha256": "8e5bea2f9d3590ea34a9ca4e2c1db94c3f9a5f7c52e1267237ab58ce9953c4e2",
+ "target_count": 3,
+ "target_coordinates": "original-image pixel coordinates (x0,y0,x1,y1)",
+ "seed": 42
+}
diff --git a/examples/english_case/teacher_output.json b/examples/english_case/teacher_output.json
new file mode 100644
index 0000000000000000000000000000000000000000..661cfa064548e2cbc61eed4be66a5a9cd4d35eb7
--- /dev/null
+++ b/examples/english_case/teacher_output.json
@@ -0,0 +1,47 @@
+{
+ "model_id": "PixText-Teacher",
+ "variant": "teacher",
+ "seed": 42,
+ "sample_id": "image",
+ "steps": 25,
+ "guidance_scale": 3.3,
+ "guidance_interval": [
+ 0.1,
+ 1.0
+ ],
+ "precision": "torch.bfloat16",
+ "geometry": [
+ {
+ "offset": 0,
+ "selected_font_indices": [
+ 0,
+ 0,
+ 0
+ ],
+ "reference_size": [
+ 1024,
+ 1024
+ ],
+ "crops": [
+ [
+ 381,
+ 402,
+ 16,
+ 32
+ ],
+ [
+ 448,
+ 403,
+ 128,
+ 48
+ ],
+ [
+ 590,
+ 394,
+ 96,
+ 48
+ ]
+ ]
+ }
+ ]
+}
diff --git a/examples/english_case/teacher_output.png b/examples/english_case/teacher_output.png
new file mode 100644
index 0000000000000000000000000000000000000000..98c5424234cd249a0da22457cc862331d07f2949
--- /dev/null
+++ b/examples/english_case/teacher_output.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2b9f5d531a1cc14842844038fba0706d629ac6161b2b7030d26dad5550f14f28
+size 859747
diff --git a/examples/english_case/teacher_output_boxed.png b/examples/english_case/teacher_output_boxed.png
new file mode 100644
index 0000000000000000000000000000000000000000..c0d9e0043ff449c366cc292675298b844f215f6b
--- /dev/null
+++ b/examples/english_case/teacher_output_boxed.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b91371f80b99b84eaab2053e86b64159a96212cdca4651b6d9c67c0aabefc855
+size 874372
diff --git a/examples/pipeline_case/details/p01_input.png b/examples/pipeline_case/details/p01_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..8b1b29320bc827eae2a6b2f4e7b591e4c7161e3a
Binary files /dev/null and b/examples/pipeline_case/details/p01_input.png differ
diff --git a/examples/pipeline_case/details/p01_meanflow.png b/examples/pipeline_case/details/p01_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..1301cb469d9a08c1ab9cb66b95c97c116506862d
Binary files /dev/null and b/examples/pipeline_case/details/p01_meanflow.png differ
diff --git a/examples/pipeline_case/details/p01_teacher.png b/examples/pipeline_case/details/p01_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..76525f0cb04797ee778cddb22030ba9ad906216e
Binary files /dev/null and b/examples/pipeline_case/details/p01_teacher.png differ
diff --git a/examples/pipeline_case/details/p02_input.png b/examples/pipeline_case/details/p02_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..bf3d1150fbd81a901fe909503859fbb1615f86b6
Binary files /dev/null and b/examples/pipeline_case/details/p02_input.png differ
diff --git a/examples/pipeline_case/details/p02_meanflow.png b/examples/pipeline_case/details/p02_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..674e5dbbb9a964949acefff8dd34d720b478ce39
Binary files /dev/null and b/examples/pipeline_case/details/p02_meanflow.png differ
diff --git a/examples/pipeline_case/details/p02_teacher.png b/examples/pipeline_case/details/p02_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..06d91df5036b32681be7c4c578c7b0be7d2d30f9
Binary files /dev/null and b/examples/pipeline_case/details/p02_teacher.png differ
diff --git a/examples/pipeline_case/details/p03_input.png b/examples/pipeline_case/details/p03_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..53c28159ea584a29ce948d621a5d00878402da7d
Binary files /dev/null and b/examples/pipeline_case/details/p03_input.png differ
diff --git a/examples/pipeline_case/details/p03_meanflow.png b/examples/pipeline_case/details/p03_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..c06dd6781996c573b8d7c9ca48e6983fce01ec11
Binary files /dev/null and b/examples/pipeline_case/details/p03_meanflow.png differ
diff --git a/examples/pipeline_case/details/p03_teacher.png b/examples/pipeline_case/details/p03_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..b8a3a9b0cedcb9a54c09dfe6cea30fd65448b5d5
Binary files /dev/null and b/examples/pipeline_case/details/p03_teacher.png differ
diff --git a/examples/pipeline_case/details/p04_input.png b/examples/pipeline_case/details/p04_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..7f8f9c52c317e93620b0dbdc3a43c5286e005912
Binary files /dev/null and b/examples/pipeline_case/details/p04_input.png differ
diff --git a/examples/pipeline_case/details/p04_meanflow.png b/examples/pipeline_case/details/p04_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..1b205c387b43765ba5b926dc0577fb4c4f155993
Binary files /dev/null and b/examples/pipeline_case/details/p04_meanflow.png differ
diff --git a/examples/pipeline_case/details/p04_teacher.png b/examples/pipeline_case/details/p04_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..23d9319ede8fa79f7c502b6cc64aa1032952eaa9
Binary files /dev/null and b/examples/pipeline_case/details/p04_teacher.png differ
diff --git a/examples/pipeline_case/details/p05_input.png b/examples/pipeline_case/details/p05_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..c3bdcb27fd00b5661e4206b8a36d9c45385fd2c3
Binary files /dev/null and b/examples/pipeline_case/details/p05_input.png differ
diff --git a/examples/pipeline_case/details/p05_meanflow.png b/examples/pipeline_case/details/p05_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..3fbbd229127b2802c53ef7177c4d18dfb2846317
Binary files /dev/null and b/examples/pipeline_case/details/p05_meanflow.png differ
diff --git a/examples/pipeline_case/details/p05_teacher.png b/examples/pipeline_case/details/p05_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..e3adeb06a7cea6a1402470e74a15844c9a63fe89
Binary files /dev/null and b/examples/pipeline_case/details/p05_teacher.png differ
diff --git a/examples/pipeline_case/details/p06_input.png b/examples/pipeline_case/details/p06_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..dfdfc70894f56b80bc663a0cc777743a6c1f961d
Binary files /dev/null and b/examples/pipeline_case/details/p06_input.png differ
diff --git a/examples/pipeline_case/details/p06_meanflow.png b/examples/pipeline_case/details/p06_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..04e5f01860c99377e010eb0dc9413a0eaca6cf07
Binary files /dev/null and b/examples/pipeline_case/details/p06_meanflow.png differ
diff --git a/examples/pipeline_case/details/p06_teacher.png b/examples/pipeline_case/details/p06_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..37753d19d59a408316e6b831b6b0b50a77c6d780
Binary files /dev/null and b/examples/pipeline_case/details/p06_teacher.png differ
diff --git a/examples/pipeline_case/details/p07_input.png b/examples/pipeline_case/details/p07_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..225cbbb0a35be016ef9cc2b4c3ecd56318de5d28
Binary files /dev/null and b/examples/pipeline_case/details/p07_input.png differ
diff --git a/examples/pipeline_case/details/p07_meanflow.png b/examples/pipeline_case/details/p07_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..f33b261dbe3d643fbdb6356180af9cd862f34e69
Binary files /dev/null and b/examples/pipeline_case/details/p07_meanflow.png differ
diff --git a/examples/pipeline_case/details/p07_teacher.png b/examples/pipeline_case/details/p07_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..1d487c31e9b41d242b351fb4bcbaa1e29d75c4a5
Binary files /dev/null and b/examples/pipeline_case/details/p07_teacher.png differ
diff --git a/examples/pipeline_case/details/p08_input.png b/examples/pipeline_case/details/p08_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..15ed8ee8e794bf9635cc249550761d623764ab2a
Binary files /dev/null and b/examples/pipeline_case/details/p08_input.png differ
diff --git a/examples/pipeline_case/details/p08_meanflow.png b/examples/pipeline_case/details/p08_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..76e52400f5c6152420804016088fc73a883e7521
Binary files /dev/null and b/examples/pipeline_case/details/p08_meanflow.png differ
diff --git a/examples/pipeline_case/details/p08_teacher.png b/examples/pipeline_case/details/p08_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..d306102c5e271d689952f02d0de569039bb1ad66
Binary files /dev/null and b/examples/pipeline_case/details/p08_teacher.png differ
diff --git a/examples/pipeline_case/details/p09_input.png b/examples/pipeline_case/details/p09_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..f98337bb2309007797797b381a70eb3e8f949700
Binary files /dev/null and b/examples/pipeline_case/details/p09_input.png differ
diff --git a/examples/pipeline_case/details/p09_meanflow.png b/examples/pipeline_case/details/p09_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..72df1ff0e247163cfc3a7c5d264d26de0c48d5e8
Binary files /dev/null and b/examples/pipeline_case/details/p09_meanflow.png differ
diff --git a/examples/pipeline_case/details/p09_teacher.png b/examples/pipeline_case/details/p09_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..c345bbac67eb4f8d0ab5ff10154db3e91ea6c773
Binary files /dev/null and b/examples/pipeline_case/details/p09_teacher.png differ
diff --git a/examples/pipeline_case/details/p10_input.png b/examples/pipeline_case/details/p10_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..ab3831ae767b375cf5a8de8d8a9babde0fe40f4b
Binary files /dev/null and b/examples/pipeline_case/details/p10_input.png differ
diff --git a/examples/pipeline_case/details/p10_meanflow.png b/examples/pipeline_case/details/p10_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..cd1deb470ddd5d9e017c53756cd6f510f9d5ba57
Binary files /dev/null and b/examples/pipeline_case/details/p10_meanflow.png differ
diff --git a/examples/pipeline_case/details/p10_teacher.png b/examples/pipeline_case/details/p10_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..87a0435c3d434cd76e68679fa4da181e75e22259
Binary files /dev/null and b/examples/pipeline_case/details/p10_teacher.png differ
diff --git a/examples/pipeline_case/details/p11_input.png b/examples/pipeline_case/details/p11_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..10b62593ae173c201a9224d45768e2f125ed7622
Binary files /dev/null and b/examples/pipeline_case/details/p11_input.png differ
diff --git a/examples/pipeline_case/details/p11_meanflow.png b/examples/pipeline_case/details/p11_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..b58d03ea829d705da2f62eda8b71b7c270bd7480
Binary files /dev/null and b/examples/pipeline_case/details/p11_meanflow.png differ
diff --git a/examples/pipeline_case/details/p11_teacher.png b/examples/pipeline_case/details/p11_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..4f483564887755f52bc93bd72c96385071d93b8d
Binary files /dev/null and b/examples/pipeline_case/details/p11_teacher.png differ
diff --git a/examples/pipeline_case/details/p12_input.png b/examples/pipeline_case/details/p12_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..f0854ccd0147955103be11a1656babd956d2d663
Binary files /dev/null and b/examples/pipeline_case/details/p12_input.png differ
diff --git a/examples/pipeline_case/details/p12_meanflow.png b/examples/pipeline_case/details/p12_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..9f03dc94f1320c7feff36d99a553d5bdcf297e27
Binary files /dev/null and b/examples/pipeline_case/details/p12_meanflow.png differ
diff --git a/examples/pipeline_case/details/p12_teacher.png b/examples/pipeline_case/details/p12_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..5fe748fffe418480193c347106e12fa83a2e0852
Binary files /dev/null and b/examples/pipeline_case/details/p12_teacher.png differ
diff --git a/examples/pipeline_case/details/p13_input.png b/examples/pipeline_case/details/p13_input.png
new file mode 100644
index 0000000000000000000000000000000000000000..e1a0c2ee96e3f7b6c7c4746cb00a6ec60590925d
Binary files /dev/null and b/examples/pipeline_case/details/p13_input.png differ
diff --git a/examples/pipeline_case/details/p13_meanflow.png b/examples/pipeline_case/details/p13_meanflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..0d6ccabab791064deec8978e76cbbecb2cded44d
Binary files /dev/null and b/examples/pipeline_case/details/p13_meanflow.png differ
diff --git a/examples/pipeline_case/details/p13_teacher.png b/examples/pipeline_case/details/p13_teacher.png
new file mode 100644
index 0000000000000000000000000000000000000000..596eb57a0a41f1002fc108c3d2801179a0fcc4d5
Binary files /dev/null and b/examples/pipeline_case/details/p13_teacher.png differ
diff --git a/examples/pipeline_case/edits.json b/examples/pipeline_case/edits.json
new file mode 100644
index 0000000000000000000000000000000000000000..3aaa09ee81f34fe4f50048c50fafb6836fd07f57
--- /dev/null
+++ b/examples/pipeline_case/edits.json
@@ -0,0 +1,119 @@
+[
+ {
+ "bbox": [
+ 457,
+ 29,
+ 506.2,
+ 94.2
+ ],
+ "text": "喜"
+ },
+ {
+ "bbox": [
+ 503,
+ 29.1,
+ 559.4,
+ 92.5
+ ],
+ "text": "发"
+ },
+ {
+ "bbox": [
+ 749.5,
+ 32.7,
+ 804.1,
+ 87.3
+ ],
+ "text": "甜"
+ },
+ {
+ "bbox": [
+ 846.4,
+ 30.1,
+ 897.4,
+ 88.1
+ ],
+ "text": "初"
+ },
+ {
+ "bbox": [
+ 896.6,
+ 30.8,
+ 953,
+ 92.4
+ ],
+ "text": "恋"
+ },
+ {
+ "bbox": [
+ 400.7,
+ 360.6,
+ 455.3,
+ 417
+ ],
+ "text": "鞭"
+ },
+ {
+ "bbox": [
+ 455.1,
+ 360.6,
+ 509.7,
+ 418.6
+ ],
+ "text": "炮"
+ },
+ {
+ "bbox": [
+ 739.8,
+ 362.1,
+ 797.8,
+ 421.9
+ ],
+ "text": "给"
+ },
+ {
+ "bbox": [
+ 843.9,
+ 360.5,
+ 898.5,
+ 420.3
+ ],
+ "text": "解"
+ },
+ {
+ "bbox": [
+ 898.1,
+ 360.4,
+ 957.9,
+ 422
+ ],
+ "text": "馋"
+ },
+ {
+ "bbox": [
+ 506.3,
+ 696.7,
+ 560.9,
+ 751.3
+ ],
+ "text": "满"
+ },
+ {
+ "bbox": [
+ 558.1,
+ 698.9,
+ 616.1,
+ 755.3
+ ],
+ "text": "满"
+ },
+ {
+ "bbox": [
+ 807.5,
+ 698.2,
+ 853.3,
+ 756.2
+ ],
+ "text": "畜"
+ }
+]
diff --git a/examples/pipeline_case/input.png b/examples/pipeline_case/input.png
new file mode 100644
index 0000000000000000000000000000000000000000..b86a8419fd69a9c32258a8be0e108ceebf78ad52
--- /dev/null
+++ b/examples/pipeline_case/input.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:43ed59051d54d781bde89836ae7338af82d40a79c3302a551cc2cf03ac7eade4
+size 2045642
diff --git a/examples/pipeline_case/input_boxed.png b/examples/pipeline_case/input_boxed.png
new file mode 100644
index 0000000000000000000000000000000000000000..6703f86366880dfdd7d0b6f621338322710414de
--- /dev/null
+++ b/examples/pipeline_case/input_boxed.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ee62c885826c6500cffcd72d4c85afe8c30989fac3087cade04c8ed81db97d1b
+size 2077925
diff --git a/examples/pipeline_case/input_preview.png b/examples/pipeline_case/input_preview.png
new file mode 100644
index 0000000000000000000000000000000000000000..13ee9c43a1476e5420b33ce2ad3400f7863a4d84
--- /dev/null
+++ b/examples/pipeline_case/input_preview.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:585803c20ee993762219abe2d54b18076a7cf20366590bc03bd9d3ed202284e3
+size 108498
diff --git a/examples/pipeline_case/meanflow_output.json b/examples/pipeline_case/meanflow_output.json
new file mode 100644
index 0000000000000000000000000000000000000000..0b5496f2c075015e11c2cbbc92a2cec520cd9f99
--- /dev/null
+++ b/examples/pipeline_case/meanflow_output.json
@@ -0,0 +1,128 @@
+{
+ "model_id": "PixText-MeanFlow",
+ "variant": "meanflow",
+ "seed": 42,
+ "sample_id": "image",
+ "steps": 4,
+ "guidance_scale": 3.3,
+ "guidance_interval": [
+ 0.1,
+ 1.0
+ ],
+ "precision": "torch.bfloat16",
+ "geometry": [
+ {
+ "offset": 0,
+ "selected_font_indices": [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ],
+ "reference_size": [
+ 1024,
+ 1024
+ ],
+ "crops": [
+ [
+ 450,
+ 22,
+ 64,
+ 80
+ ],
+ [
+ 499,
+ 29,
+ 64,
+ 64
+ ],
+ [
+ 745,
+ 28,
+ 64,
+ 64
+ ],
+ [
+ 840,
+ 27,
+ 64,
+ 64
+ ],
+ [
+ 893,
+ 30,
+ 64,
+ 64
+ ],
+ [
+ 396,
+ 357,
+ 64,
+ 64
+ ],
+ [
+ 450,
+ 358,
+ 64,
+ 64
+ ],
+ [
+ 737,
+ 360,
+ 64,
+ 64
+ ],
+ [
+ 839,
+ 358,
+ 64,
+ 64
+ ],
+ [
+ 896,
+ 359,
+ 64,
+ 64
+ ],
+ [
+ 502,
+ 692,
+ 64,
+ 64
+ ],
+ [
+ 555,
+ 695,
+ 64,
+ 64
+ ]
+ ]
+ },
+ {
+ "offset": 12,
+ "selected_font_indices": [
+ 0
+ ],
+ "reference_size": [
+ 1024,
+ 1024
+ ],
+ "crops": [
+ [
+ 806,
+ 695,
+ 48,
+ 64
+ ]
+ ]
+ }
+ ]
+}
diff --git a/examples/pipeline_case/meanflow_output.png b/examples/pipeline_case/meanflow_output.png
new file mode 100644
index 0000000000000000000000000000000000000000..e9f1ac1f65b86b38dd9ec99b7082a6a54c07ef16
--- /dev/null
+++ b/examples/pipeline_case/meanflow_output.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7925d06856a65468a5f327d9e07988e1cc8ff5d029e18ea435c95f7ba7ba1b1f
+size 2040614
diff --git a/examples/pipeline_case/meanflow_output_boxed.png b/examples/pipeline_case/meanflow_output_boxed.png
new file mode 100644
index 0000000000000000000000000000000000000000..5f066103df7322b52ae0fcbb72e5c2daeace3fe1
--- /dev/null
+++ b/examples/pipeline_case/meanflow_output_boxed.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7caef2cb9284f321349620eee1354e6a1557361beab906848146d7d654539e7a
+size 2074659
diff --git a/examples/pipeline_case/meanflow_output_preview.png b/examples/pipeline_case/meanflow_output_preview.png
new file mode 100644
index 0000000000000000000000000000000000000000..f1460985be62514235cd66d7519d646157343c56
--- /dev/null
+++ b/examples/pipeline_case/meanflow_output_preview.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0ff1be75022075f75a3973ea2ed7fc960e6fcbd4c7f20641b1970bfd62a51564
+size 108640
diff --git a/examples/pipeline_case/paper_reference.png b/examples/pipeline_case/paper_reference.png
new file mode 100644
index 0000000000000000000000000000000000000000..53957b069e7082dff9d57d18e9dd6b23d757a662
--- /dev/null
+++ b/examples/pipeline_case/paper_reference.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6385ce075a4802d027dbc316d68a97b8dbac73cd123cd5526e7ab147f1757b37
+size 2066707
diff --git a/examples/pipeline_case/source.json b/examples/pipeline_case/source.json
new file mode 100644
index 0000000000000000000000000000000000000000..9a12f85845ee8e62eb6ed144374fb538ea43c8f3
--- /dev/null
+++ b/examples/pipeline_case/source.json
@@ -0,0 +1,7 @@
+{
+ "sample_id": "sample_000103",
+ "source_image_sha256": "43ed59051d54d781bde89836ae7338af82d40a79c3302a551cc2cf03ac7eade4",
+ "target_count": 13,
+ "target_coordinates": "axis-aligned bounds of original benchmark polygons, (x0,y0,x1,y1)",
+ "seed": 42
+}
diff --git a/examples/pipeline_case/teacher_output.json b/examples/pipeline_case/teacher_output.json
new file mode 100644
index 0000000000000000000000000000000000000000..98bacd0699ee20cac1b34eff7aa1e09bdb7ff164
--- /dev/null
+++ b/examples/pipeline_case/teacher_output.json
@@ -0,0 +1,128 @@
+{
+ "model_id": "PixText-Teacher",
+ "variant": "teacher",
+ "seed": 42,
+ "sample_id": "image",
+ "steps": 25,
+ "guidance_scale": 3.3,
+ "guidance_interval": [
+ 0.1,
+ 1.0
+ ],
+ "precision": "torch.bfloat16",
+ "geometry": [
+ {
+ "offset": 0,
+ "selected_font_indices": [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ],
+ "reference_size": [
+ 1024,
+ 1024
+ ],
+ "crops": [
+ [
+ 450,
+ 22,
+ 64,
+ 80
+ ],
+ [
+ 499,
+ 29,
+ 64,
+ 64
+ ],
+ [
+ 745,
+ 28,
+ 64,
+ 64
+ ],
+ [
+ 840,
+ 27,
+ 64,
+ 64
+ ],
+ [
+ 893,
+ 30,
+ 64,
+ 64
+ ],
+ [
+ 396,
+ 357,
+ 64,
+ 64
+ ],
+ [
+ 450,
+ 358,
+ 64,
+ 64
+ ],
+ [
+ 737,
+ 360,
+ 64,
+ 64
+ ],
+ [
+ 839,
+ 358,
+ 64,
+ 64
+ ],
+ [
+ 896,
+ 359,
+ 64,
+ 64
+ ],
+ [
+ 502,
+ 692,
+ 64,
+ 64
+ ],
+ [
+ 555,
+ 695,
+ 64,
+ 64
+ ]
+ ]
+ },
+ {
+ "offset": 12,
+ "selected_font_indices": [
+ 0
+ ],
+ "reference_size": [
+ 1024,
+ 1024
+ ],
+ "crops": [
+ [
+ 806,
+ 695,
+ 48,
+ 64
+ ]
+ ]
+ }
+ ]
+}
diff --git a/examples/pipeline_case/teacher_output.png b/examples/pipeline_case/teacher_output.png
new file mode 100644
index 0000000000000000000000000000000000000000..f78030006a32c65c7520b046ee9d3586574f9a45
--- /dev/null
+++ b/examples/pipeline_case/teacher_output.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5588a0c141cbd7b642a79daea9bfdf6c76b8c121d32a19fe6c723891a17e120c
+size 2042619
diff --git a/examples/pipeline_case/teacher_output_boxed.png b/examples/pipeline_case/teacher_output_boxed.png
new file mode 100644
index 0000000000000000000000000000000000000000..8d7a6a0624dda97013b3a17d8a05b7bc84fb66dd
--- /dev/null
+++ b/examples/pipeline_case/teacher_output_boxed.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:44db92f90f8e0dcc976a4fa99e0d1869c64deb1280eb7c6e82b1a6df82644253
+size 2076283
diff --git a/examples/pipeline_case/teacher_output_preview.png b/examples/pipeline_case/teacher_output_preview.png
new file mode 100644
index 0000000000000000000000000000000000000000..6259d895158dfd781d3c8a757031513ce6fc3e06
--- /dev/null
+++ b/examples/pipeline_case/teacher_output_preview.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3f0e6eb8efa4302a981c7a42cfdcbe43a5926cf343fe6e96492b3262c466ae1b
+size 108613
diff --git a/manifest.sha256 b/manifest.sha256
new file mode 100644
index 0000000000000000000000000000000000000000..12e5b99ec03bf9c51b04ffb8426b5f277365c91a
--- /dev/null
+++ b/manifest.sha256
@@ -0,0 +1,19 @@
+2ea457f4021f107e176cb4729f212f4d08a97719490e3ddda3c73f7e77456c2c model_index.json
+14207024ad2c77f1850a6dfd80bff8a0eae5fb39494f42128594cfa26379187e models/PixText-MeanFlow/README.md
+b45b510a6ed39bb9115f1ac9e5f8b3644f880d304842c53acd4896650381a1d5 models/PixText-MeanFlow/config.json
+be33bc8d45ced30fa5c542f6f056565baf85003d4e079522110d76016f8a04e2 models/PixText-MeanFlow/fonts/AlibabaPuHuiTi-3-55-Regular.ttf
+bfe18b47612e58ff28b568f32b55e35fde4505d6137581bf11d2363e257e2ad4 models/PixText-MeanFlow/fonts/GoNotoCJKCore-v7.0.ttf
+6a73f9541c2de74158c0e7cf6b0a58ef774f5a780bf191f2d7ec9cc53efe2bf2 models/PixText-MeanFlow/fonts/OFL-GoNoto.txt
+324d54226d3a8db749b06695255fa5e6548122ba67ff5f97a9f300b761c04fe6 models/PixText-MeanFlow/fonts/README.md
+edde55e9f06bbb6f13eba6873d63d4a42544544f4b447f891d9991cb73168ff3 models/PixText-MeanFlow/inference_config.json
+9602710000b1ed3ba3c987514a1428b3c1fe3d9f55d5ff90f41c67cad927b166 models/PixText-MeanFlow/manifest.json
+d622bb403165c17853bcb9050e6df97330617df7d22516840f2be719240a08ea models/PixText-MeanFlow/model.safetensors
+31cc167084c8748eefeecd8fcfad81631937ca03ac1912415b17b554503746ec models/PixText-Teacher/README.md
+fee3341922b8cd45ec6aaa95449456139d8ec13f8352299c045de44c388c0662 models/PixText-Teacher/config.json
+be33bc8d45ced30fa5c542f6f056565baf85003d4e079522110d76016f8a04e2 models/PixText-Teacher/fonts/AlibabaPuHuiTi-3-55-Regular.ttf
+bfe18b47612e58ff28b568f32b55e35fde4505d6137581bf11d2363e257e2ad4 models/PixText-Teacher/fonts/GoNotoCJKCore-v7.0.ttf
+6a73f9541c2de74158c0e7cf6b0a58ef774f5a780bf191f2d7ec9cc53efe2bf2 models/PixText-Teacher/fonts/OFL-GoNoto.txt
+324d54226d3a8db749b06695255fa5e6548122ba67ff5f97a9f300b761c04fe6 models/PixText-Teacher/fonts/README.md
+11ebfb69ad6cb70fa09372827c05e79bb6dc94c377ad45804d5c6c9da434ef14 models/PixText-Teacher/inference_config.json
+174b82c7b336f05a1da439848156cd47299e24bda90e4bdf3653019e5e8a287f models/PixText-Teacher/manifest.json
+4717506a7934334fd04755e5d5f22f398fd31c170cc6f3ea76b48cd99458ec28 models/PixText-Teacher/model.safetensors
diff --git a/model_index.json b/model_index.json
new file mode 100644
index 0000000000000000000000000000000000000000..f3a01fe5a86be11d6a3e7a164f469833dbea1158
--- /dev/null
+++ b/model_index.json
@@ -0,0 +1,27 @@
+{
+ "format_version": 1,
+ "models": [
+ {
+ "model_id": "PixText-Teacher",
+ "directory": "models/PixText-Teacher",
+ "weights_sha256": "4717506a7934334fd04755e5d5f22f398fd31c170cc6f3ea76b48cd99458ec28",
+ "steps": 25,
+ "guidance_scale": 3.3,
+ "bundled_fonts": [
+ "AlibabaPuHuiTi-3-55-Regular.ttf",
+ "GoNotoCJKCore-v7.0.ttf"
+ ]
+ },
+ {
+ "model_id": "PixText-MeanFlow",
+ "directory": "models/PixText-MeanFlow",
+ "weights_sha256": "d622bb403165c17853bcb9050e6df97330617df7d22516840f2be719240a08ea",
+ "steps": 4,
+ "guidance_scale": 3.3,
+ "bundled_fonts": [
+ "AlibabaPuHuiTi-3-55-Regular.ttf",
+ "GoNotoCJKCore-v7.0.ttf"
+ ]
+ }
+ ]
+}
diff --git a/models/PixText-MeanFlow/README.md b/models/PixText-MeanFlow/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..83108b14462dababfada9e206d27e7159147fa68
--- /dev/null
+++ b/models/PixText-MeanFlow/README.md
@@ -0,0 +1,9 @@
+# PixText-MeanFlow
+
+PixText glyph-conditioned local text refinement. This package contains the paper-selected EMA weights and both exact glyph fonts.
+
+Default sampling: 4 steps, meanflow_interval_euler, glyph CFG 3.3 active on the open interval (0.1, 1.0). Target text requires no text encoder. MeanFlow inference uses the student only.
+
+Load with `PixTextPipeline.from_pretrained("path/to/PixText-MeanFlow")`. See the code repository README for inputs and hardware requirements.
+
+Released under the Apache License 2.0; see `LICENSE` at the release root. The bundled fonts keep their own terms, described in `fonts/`.
diff --git a/models/PixText-MeanFlow/config.json b/models/PixText-MeanFlow/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..94140087d45664fdcf235aae7dad5c247295b0ca
--- /dev/null
+++ b/models/PixText-MeanFlow/config.json
@@ -0,0 +1,20 @@
+{
+ "format_version": 1,
+ "variant": "meanflow",
+ "model": {
+ "patch_size": 16,
+ "in_channels": 3,
+ "hidden_size": 1280,
+ "depth": 32,
+ "num_heads": 16,
+ "mlp_ratio": 4.0,
+ "axes_dims": [
+ 12,
+ 34,
+ 34
+ ],
+ "theta": 10000.0,
+ "interval_conditioning": true,
+ "image_attention_routing": "items_interread_glyph_reads_own_item_bidirectional_main"
+ }
+}
diff --git a/models/PixText-MeanFlow/fonts/AlibabaPuHuiTi-3-55-Regular.ttf b/models/PixText-MeanFlow/fonts/AlibabaPuHuiTi-3-55-Regular.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..0b637c22aca5e2790985facad27d907607def880
--- /dev/null
+++ b/models/PixText-MeanFlow/fonts/AlibabaPuHuiTi-3-55-Regular.ttf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:be33bc8d45ced30fa5c542f6f056565baf85003d4e079522110d76016f8a04e2
+size 8532824
diff --git a/models/PixText-MeanFlow/fonts/GoNotoCJKCore-v7.0.ttf b/models/PixText-MeanFlow/fonts/GoNotoCJKCore-v7.0.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..1c0075801c9712bcb24fb34bde39b0943e0efe85
--- /dev/null
+++ b/models/PixText-MeanFlow/fonts/GoNotoCJKCore-v7.0.ttf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bfe18b47612e58ff28b568f32b55e35fde4505d6137581bf11d2363e257e2ad4
+size 18499972
diff --git a/models/PixText-MeanFlow/fonts/OFL-GoNoto.txt b/models/PixText-MeanFlow/fonts/OFL-GoNoto.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d952d62c065f3f35fb83a173496e90b21525aef3
--- /dev/null
+++ b/models/PixText-MeanFlow/fonts/OFL-GoNoto.txt
@@ -0,0 +1,92 @@
+This Font Software is licensed under the SIL Open Font License,
+Version 1.1.
+
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font
+creation efforts of academic and linguistic communities, and to
+provide a free and open framework in which fonts may be shared and
+improved in partnership with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply to
+any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software
+components as distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to,
+deleting, or substituting -- in part or in whole -- any of the
+components of the Original Version, by changing formats or by porting
+the Font Software to a new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed,
+modify, redistribute, and sell modified and unmodified copies of the
+Font Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components, in
+Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the
+corresponding Copyright Holder. This restriction only applies to the
+primary font name as presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created using
+the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/models/PixText-MeanFlow/fonts/README.md b/models/PixText-MeanFlow/fonts/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..7c457f90a64123fdb15b7b0f754bb7f926b857fd
--- /dev/null
+++ b/models/PixText-MeanFlow/fonts/README.md
@@ -0,0 +1,5 @@
+# Bundled glyph fonts
+
+PixText uses Alibaba PuHuiTi 3.0 55 Regular (version 3.01) as the primary font and Go Noto CJK Core v7.0 as whole-item fallback. The exact binaries are checked against the model manifest.
+
+Alibaba PuHuiTi copyright: Alibaba (China) Co., Ltd. Font terms: https://www.alibabafonts.com/ . Go Noto CJK is distributed under SIL OFL 1.1; see OFL-GoNoto.txt. Font terms are separate from the code and model weights.
diff --git a/models/PixText-MeanFlow/inference_config.json b/models/PixText-MeanFlow/inference_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..885f73c29ef3699c1300747baf323445216a8fd2
--- /dev/null
+++ b/models/PixText-MeanFlow/inference_config.json
@@ -0,0 +1,43 @@
+{
+ "format_version": 1,
+ "geometry": {
+ "main_target_area": 1048576,
+ "patch_size": 16,
+ "clamp_main_to_reference": true
+ },
+ "sampling": {
+ "steps": 4,
+ "solver": "meanflow_interval_euler",
+ "guidance_scale": 3.3,
+ "guidance_interval": [
+ 0.1,
+ 1.0
+ ],
+ "noise_scale": 1.0,
+ "max_items_per_pass": 12
+ },
+ "main_condition": {
+ "degradation_region": "strict_ocr_bbox",
+ "operators": [
+ "defocus",
+ "gaussian_blur"
+ ],
+ "required_operators": [],
+ "min_operators": 2,
+ "max_operators": 2,
+ "severity_min": 0.7,
+ "severity_max": 1.0
+ },
+ "glyph": {
+ "font_sha256": "be33bc8d45ced30fa5c542f6f056565baf85003d4e079522110d76016f8a04e2",
+ "fallback_font_sha256": "bfe18b47612e58ff28b568f32b55e35fde4505d6137581bf11d2363e257e2ad4",
+ "occupancy": 0.85,
+ "layout_engine": "RAQM",
+ "language": "zh-CN",
+ "opentype_features": [
+ "locl"
+ ],
+ "font_path": "fonts/AlibabaPuHuiTi-3-55-Regular.ttf",
+ "fallback_font_path": "fonts/GoNotoCJKCore-v7.0.ttf"
+ }
+}
diff --git a/models/PixText-MeanFlow/manifest.json b/models/PixText-MeanFlow/manifest.json
new file mode 100644
index 0000000000000000000000000000000000000000..4ee4436c7a02b416bc9508bcd55085d53f7e8b50
--- /dev/null
+++ b/models/PixText-MeanFlow/manifest.json
@@ -0,0 +1,16 @@
+{
+ "format_version": 1,
+ "model_id": "PixText-MeanFlow",
+ "variant": "meanflow",
+ "weights": "ema",
+ "files": {
+ "config.json": "b45b510a6ed39bb9115f1ac9e5f8b3644f880d304842c53acd4896650381a1d5",
+ "fonts/AlibabaPuHuiTi-3-55-Regular.ttf": "be33bc8d45ced30fa5c542f6f056565baf85003d4e079522110d76016f8a04e2",
+ "fonts/GoNotoCJKCore-v7.0.ttf": "bfe18b47612e58ff28b568f32b55e35fde4505d6137581bf11d2363e257e2ad4",
+ "fonts/OFL-GoNoto.txt": "6a73f9541c2de74158c0e7cf6b0a58ef774f5a780bf191f2d7ec9cc53efe2bf2",
+ "inference_config.json": "edde55e9f06bbb6f13eba6873d63d4a42544544f4b447f891d9991cb73168ff3",
+ "model.safetensors": "d622bb403165c17853bcb9050e6df97330617df7d22516840f2be719240a08ea",
+ "fonts/README.md": "324d54226d3a8db749b06695255fa5e6548122ba67ff5f97a9f300b761c04fe6"
+ },
+ "code_version": "0.1.0"
+}
diff --git a/models/PixText-MeanFlow/model.safetensors b/models/PixText-MeanFlow/model.safetensors
new file mode 100644
index 0000000000000000000000000000000000000000..354f0572aef83452e72ac5b62b4d50f1c26e48b9
--- /dev/null
+++ b/models/PixText-MeanFlow/model.safetensors
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d622bb403165c17853bcb9050e6df97330617df7d22516840f2be719240a08ea
+size 1907943360
diff --git a/models/PixText-Teacher/README.md b/models/PixText-Teacher/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..244ab3a83543b9da92027202e2c27d66b5bcf67d
--- /dev/null
+++ b/models/PixText-Teacher/README.md
@@ -0,0 +1,9 @@
+# PixText-Teacher
+
+PixText glyph-conditioned local text refinement. This package contains the paper-selected EMA weights and both exact glyph fonts.
+
+Default sampling: 25 steps, euler, glyph CFG 3.3 active on the open interval (0.1, 1.0). Target text requires no text encoder. MeanFlow inference uses the student only.
+
+Load with `PixTextPipeline.from_pretrained("path/to/PixText-Teacher")`. See the code repository README for inputs and hardware requirements.
+
+Released under the Apache License 2.0; see `LICENSE` at the release root. The bundled fonts keep their own terms, described in `fonts/`.
diff --git a/models/PixText-Teacher/config.json b/models/PixText-Teacher/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..b13e5381a83946fc05071cfdbc2ff778a37a586b
--- /dev/null
+++ b/models/PixText-Teacher/config.json
@@ -0,0 +1,20 @@
+{
+ "format_version": 1,
+ "variant": "teacher",
+ "model": {
+ "patch_size": 16,
+ "in_channels": 3,
+ "hidden_size": 1280,
+ "depth": 32,
+ "num_heads": 16,
+ "mlp_ratio": 4.0,
+ "axes_dims": [
+ 12,
+ 34,
+ 34
+ ],
+ "theta": 10000.0,
+ "interval_conditioning": false,
+ "image_attention_routing": "items_interread_glyph_reads_own_item_bidirectional_main"
+ }
+}
diff --git a/models/PixText-Teacher/fonts/AlibabaPuHuiTi-3-55-Regular.ttf b/models/PixText-Teacher/fonts/AlibabaPuHuiTi-3-55-Regular.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..0b637c22aca5e2790985facad27d907607def880
--- /dev/null
+++ b/models/PixText-Teacher/fonts/AlibabaPuHuiTi-3-55-Regular.ttf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:be33bc8d45ced30fa5c542f6f056565baf85003d4e079522110d76016f8a04e2
+size 8532824
diff --git a/models/PixText-Teacher/fonts/GoNotoCJKCore-v7.0.ttf b/models/PixText-Teacher/fonts/GoNotoCJKCore-v7.0.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..1c0075801c9712bcb24fb34bde39b0943e0efe85
--- /dev/null
+++ b/models/PixText-Teacher/fonts/GoNotoCJKCore-v7.0.ttf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bfe18b47612e58ff28b568f32b55e35fde4505d6137581bf11d2363e257e2ad4
+size 18499972
diff --git a/models/PixText-Teacher/fonts/OFL-GoNoto.txt b/models/PixText-Teacher/fonts/OFL-GoNoto.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d952d62c065f3f35fb83a173496e90b21525aef3
--- /dev/null
+++ b/models/PixText-Teacher/fonts/OFL-GoNoto.txt
@@ -0,0 +1,92 @@
+This Font Software is licensed under the SIL Open Font License,
+Version 1.1.
+
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font
+creation efforts of academic and linguistic communities, and to
+provide a free and open framework in which fonts may be shared and
+improved in partnership with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply to
+any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software
+components as distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to,
+deleting, or substituting -- in part or in whole -- any of the
+components of the Original Version, by changing formats or by porting
+the Font Software to a new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed,
+modify, redistribute, and sell modified and unmodified copies of the
+Font Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components, in
+Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the
+corresponding Copyright Holder. This restriction only applies to the
+primary font name as presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created using
+the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/models/PixText-Teacher/fonts/README.md b/models/PixText-Teacher/fonts/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..7c457f90a64123fdb15b7b0f754bb7f926b857fd
--- /dev/null
+++ b/models/PixText-Teacher/fonts/README.md
@@ -0,0 +1,5 @@
+# Bundled glyph fonts
+
+PixText uses Alibaba PuHuiTi 3.0 55 Regular (version 3.01) as the primary font and Go Noto CJK Core v7.0 as whole-item fallback. The exact binaries are checked against the model manifest.
+
+Alibaba PuHuiTi copyright: Alibaba (China) Co., Ltd. Font terms: https://www.alibabafonts.com/ . Go Noto CJK is distributed under SIL OFL 1.1; see OFL-GoNoto.txt. Font terms are separate from the code and model weights.
diff --git a/models/PixText-Teacher/inference_config.json b/models/PixText-Teacher/inference_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..15511a0bf95dd75c3f666b1e7d584f33920b86b1
--- /dev/null
+++ b/models/PixText-Teacher/inference_config.json
@@ -0,0 +1,43 @@
+{
+ "format_version": 1,
+ "geometry": {
+ "main_target_area": 1048576,
+ "patch_size": 16,
+ "clamp_main_to_reference": true
+ },
+ "sampling": {
+ "steps": 25,
+ "solver": "euler",
+ "guidance_scale": 3.3,
+ "guidance_interval": [
+ 0.1,
+ 1.0
+ ],
+ "noise_scale": 1.0,
+ "max_items_per_pass": 12
+ },
+ "main_condition": {
+ "degradation_region": "strict_ocr_bbox",
+ "operators": [
+ "defocus",
+ "gaussian_blur"
+ ],
+ "required_operators": [],
+ "min_operators": 2,
+ "max_operators": 2,
+ "severity_min": 0.7,
+ "severity_max": 1.0
+ },
+ "glyph": {
+ "font_sha256": "be33bc8d45ced30fa5c542f6f056565baf85003d4e079522110d76016f8a04e2",
+ "fallback_font_sha256": "bfe18b47612e58ff28b568f32b55e35fde4505d6137581bf11d2363e257e2ad4",
+ "occupancy": 0.85,
+ "layout_engine": "RAQM",
+ "language": "zh-CN",
+ "opentype_features": [
+ "locl"
+ ],
+ "font_path": "fonts/AlibabaPuHuiTi-3-55-Regular.ttf",
+ "fallback_font_path": "fonts/GoNotoCJKCore-v7.0.ttf"
+ }
+}
diff --git a/models/PixText-Teacher/manifest.json b/models/PixText-Teacher/manifest.json
new file mode 100644
index 0000000000000000000000000000000000000000..26aa8cac392f8102822d66b61bead646737f58fe
--- /dev/null
+++ b/models/PixText-Teacher/manifest.json
@@ -0,0 +1,16 @@
+{
+ "format_version": 1,
+ "model_id": "PixText-Teacher",
+ "variant": "teacher",
+ "weights": "ema",
+ "files": {
+ "config.json": "fee3341922b8cd45ec6aaa95449456139d8ec13f8352299c045de44c388c0662",
+ "fonts/AlibabaPuHuiTi-3-55-Regular.ttf": "be33bc8d45ced30fa5c542f6f056565baf85003d4e079522110d76016f8a04e2",
+ "fonts/GoNotoCJKCore-v7.0.ttf": "bfe18b47612e58ff28b568f32b55e35fde4505d6137581bf11d2363e257e2ad4",
+ "fonts/OFL-GoNoto.txt": "6a73f9541c2de74158c0e7cf6b0a58ef774f5a780bf191f2d7ec9cc53efe2bf2",
+ "inference_config.json": "11ebfb69ad6cb70fa09372827c05e79bb6dc94c377ad45804d5c6c9da434ef14",
+ "model.safetensors": "4717506a7934334fd04755e5d5f22f398fd31c170cc6f3ea76b48cd99458ec28",
+ "fonts/README.md": "324d54226d3a8db749b06695255fa5e6548122ba67ff5f97a9f300b761c04fe6"
+ },
+ "code_version": "0.1.0"
+}
diff --git a/models/PixText-Teacher/model.safetensors b/models/PixText-Teacher/model.safetensors
new file mode 100644
index 0000000000000000000000000000000000000000..e03ddd2d73206bd9b9f68dda9a01d42b787637ec
--- /dev/null
+++ b/models/PixText-Teacher/model.safetensors
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4717506a7934334fd04755e5d5f22f398fd31c170cc6f3ea76b48cd99458ec28
+size 1904005664