ajh-code's picture
Add README.md
8b6e7c7 verified
|
Raw
History Blame Contribute Delete
4.54 kB
---
license: mit
library_name: mage_flow
pipeline_tag: image-to-image
base_model: microsoft/Mage-Flow-Edit-Turbo
base_model_relation: quantized
tags:
- xpo3
- mage-flow
- mage-flow-edit
- mage-flow-edit-turbo
- image-editing
- image-to-image
- nvfp4
- fp8
- blackwell
- quantization
---
<h1 align="center">Mage-Flow Edit Turbo · XPO3 NVFP4</h1>
<p align="center">
A four-step, native Blackwell W4A4 release of Mage-Flow Edit Turbo.
</p>
<p align="center">
<a href="https://huggingface.co/microsoft/Mage-Flow-Edit-Turbo">Original model</a>
·
<a href="https://huggingface.co/Comfy-Org/Mage-Flow">ComfyUI source weights</a>
·
<a href="https://huggingface.co/starsfriday/Mage-Flow-Edit-FP8">FP8 text encoder source</a>
·
<a href="https://huggingface.co/ajh-code/Mage-Flow-Turbo-XPO3-NVFP4">XPO3 text-to-image sibling</a>
</p>
---
## Download
| File | Purpose | Size |
|:--|:--|--:|
| [`Mage-Flow-Edit-Turbo-XPO3-NVFP4.safetensors`](https://huggingface.co/ajh-code/Mage-Flow-Edit-Turbo-XPO3-NVFP4/resolve/main/Mage-Flow-Edit-Turbo-XPO3-NVFP4.safetensors?download=true) | Self-contained Edit-Turbo transformer | 4.65 GB |
| [`qwen3vl_4b_fp8_scaled.safetensors`](https://huggingface.co/ajh-code/Mage-Flow-Edit-Turbo-XPO3-NVFP4/resolve/main/qwen3vl_4b_fp8_scaled.safetensors?download=true) | Shared scaled-FP8 text encoder | 5.24 GB |
| [`Mage-Flow-VAE.safetensors`](https://huggingface.co/ajh-code/Mage-Flow-Edit-Turbo-XPO3-NVFP4/resolve/main/Mage-Flow-VAE.safetensors?download=true) | Shared Mage VAE | 345 MB |
The transformer contains all retained BF16 tensors, 48 packed NVFP4 MLP
projections, and 24 offline-fused NVFP4 QKV groups. It does not require the
8.23 GB BF16 transformer.
---
## Quick start
Linux, Python 3.11, CUDA 13, and an NVIDIA Blackwell SM120 GPU are required.
```bash
hf download ajh-code/Mage-Flow-Edit-Turbo-XPO3-NVFP4 --local-dir mage-edit-xpo3
cd mage-edit-xpo3
python3.11 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
python edit.py reference.jpg \
"Replace the background with a snowy pine forest. Keep the subject unchanged." \
--output edited.png --seed 1 --max-size 1024
```
The included CLI uses the promoted profile automatically: four steps, CFG 1,
shift 6, image-only fused GELU, calibrated FP4 bridge on all 12 blocks, and
direct-HND accelerated attention on steps 1–3 with exact step-0 fallback.
Every optimization has a CLI disable switch.
> The public ComfyUI-XPO3 v0.3.0 nodes target text-to-image Turbo. Use the
> included Edit CLI until Edit-Turbo node support is released; do not load
> this checkpoint with the old Turbo Generate node.
---
## Examples
| Reference | XPO3 edit |
|:--:|:--:|
| [![Dog reference](examples/dog-reference.jpg)](examples/dog-reference.jpg) | [![Dog with snowy forest background](examples/dog-edited.png)](examples/dog-edited.png) |
| [![Fruit reference](examples/fruit-reference.jpg)](examples/fruit-reference.jpg) | [![Fruit with cobalt tablecloth](examples/fruit-edited.png)](examples/fruit-edited.png) |
The first edit changes the background while preserving the dog. The second
changes only the tablecloth while preserving the fruit and composition.
---
## Measured on RTX 5060 Ti
| 512-long-edge edit | BF16 denoise | XPO3 denoise | Speedup |
|:--|--:|--:|--:|
| Dog background | 0.5820 s | 0.3216 s | 1.81× |
| Fruit tablecloth | 0.6285 s | 0.3469 s | 1.81× |
Peak allocated memory was 5.41–5.54 GiB, 31–33% below the matched BF16 runs.
These are hot denoise measurements on one local system, not universal
end-to-end claims. Load, multimodal conditioning, reference encoding, denoise,
and VAE decode were measured separately.
## Validated scope
- Same-seed outputs were deterministic across fresh and hot repeats.
- Dog identity, pose, coat, collar, and framing survived a background change.
- Fruit type, count, layout, bowl, and lighting survived a tablecloth-only change.
- Step 0 accelerated attention was rejected after a black-image failure and
remains on exact fallback.
- The release file passed checksum, tensor-coverage, zero-source-read clean
loading, restoration, and two-case edit-quality gates.
This is an XPO3 runtime package, not a generic portable quantization format.
The bundled native libraries target Linux x86-64, Python 3.11, PyTorch
2.13.0+cu130, and SM120.
MIT for the XPO3 package and Mage-derived runtime. The scaled-FP8 Qwen3-VL
component and bundled SpargeAttn code are Apache-2.0; see
[`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md).