/ Модель

Характеристики

Лицензия
MIT
Библиотека
diffusers
Опубликована
23 июл 2026

Mage-Flow-Edit-Base

Преобразование изображенийИзображение, текст → изображение

Производная модели Mage-Fans/Mage-Flow-Edit-Base. Базовая модель Mage-Flow-Edit редактирует изображения по текстовым инструкциям, включая изменение содержания и стиля, а также восстановление.

6скачиваний за 30 дней0лайковвеса обновлены23 июл 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Карточка модели Jinstudio/Mage-Flow-Edit-Base на Hugging Face совпадает с карточкой Mage-Fans/Mage-Flow-Edit-Base, поэтому описание составлено по ней.

Mage-Flow-Edit-Base — базовый вариант модели Mage-Flow-Edit для редактирования изображений по текстовым инструкциям. Разработчики описывают семейство Mage-Flow как компактную генеративную систему масштаба 4 млрд параметров с архитектурой NR-MMDiT — мультимодальным диффузионным трансформером, обученным методом rectified flow, и общим для семейства латентным токенизатором Mage-VAE. Репозиторий рассчитан на запуск через Diffusers и содержит веса в формате safetensors.

Модель принимает исходное изображение и текстовую инструкцию. Она предназначена для семантического изменения содержимого, преобразования внешнего вида, восстановления изображений и редактирования с сохранением структуры. Семейство заявляет поддержку нативных разрешений от 512 до 2048 пикселей и разных соотношений сторон; README также упоминает разнообразие результатов для одного исходного изображения. Карточка не сообщает число параметров именно этого репозитория и не приводит отдельные оценки качества для варианта Base.

Лицензия репозитория — MIT. Для работы описан стек Diffusers; README отмечает необходимость CUDA-совместимой среды для установки flash-attn. Заявления о скорости и качестве относятся к семейству и, в частности, к Turbo-вариантам, поэтому их нельзя напрямую переносить на Base.

Сценарии применения

  • изменение объектов и содержимого изображения по инструкции
  • перенос визуального стиля и изменение внешнего вида
  • преобразование сцены, объекта или ракурса
  • восстановление повреждённых или деградированных изображений
  • создание нескольких вариантов редактирования одного исходного изображения

Ограничения

README не приводит отдельные результаты бенчмарков для варианта Base; показатели скорости и качества, приведённые для семейства, относятся преимущественно к другим вариантам, включая Turbo. Установка flash-attn требует подходящей среды с CUDA и PyTorch.

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Mage-Flow is a compact 4B-scale generative stack for efficient text-to-image generation and instruction-based image editing. Instead of scaling to tens of billions of parameters, Mage-Flow reaches state-of-the-art-competitive quality through careful tokenizer–backbone–system co-design, so it stays fast, memory-light, and easy to fine-tune under realistic compute budgets.

The stack is built from two shared, co-designed components:

  • Mage-VAE — a lightweight, high-fidelity latent tokenizer (one-step diffusion encode/decode with anchor-latent KL regularization).
  • NR-MMDiT — a shared 4B Native-Resolution Multimodal Diffusion Transformer, trained with rectified flow matching in the Mage-VAE latent space.

Together with native-resolution packing and a fused-kernel training infrastructure, this shared stack powers two model instantiations: Mage-Flow for text-to-image generation and Mage-Flow-Edit for instruction-based image editing. Each ships in Base, RL-aligned, and 4-step Turbo variants.

✨ Highlights

  • Compact & competitive. A single 4B family for generation and editing that matches or beats much larger open systems (Qwen-Image 20B, Z-Image 6B, FLUX.2 32B, FireRed-Image-Edit 20B).
  • Efficient tokenizer. Mage-VAE matches FLUX.2-VAE reconstruction fidelity while using ~12× / ~22× fewer encode / decode MACs per pixel, removing the VAE as the high-resolution bottleneck.
  • Native resolution. One checkpoint generates from 512 to 2048 on any aspect ratio, including extreme 4:1 (e.g. 512×2048, 2048×512).
  • System-level speed. Native-resolution packing (FlashAttention var-len + per-sample 2D RoPE) + fused CUDA kernels cut per-step training time from ~1.93 s → ~0.78 s (~2.5× faster training); CFG's conditional/unconditional branches run in one packed forward.
  • Full family. Base, RL-aligned, and 4-step Turbo variants for both generation and editing.
  • Versatile editing. Mage-Flow-Edit supports semantic content editing, appearance transformation, image restoration, and structure-aware outputs within a unified image-and-text-conditioned model. See the report's editing galleries.
  • Interactive latency. At 1024² on a single A100: Mage-Flow-Turbo 0.59 s/image, Mage-Flow-Edit-Turbo 1.02 s/edit, peak memory ~18–20 GB (lowest among compared systems).

📥 Model Zoo

Each checkpoint is a self-contained diffusers-style repo (transformer/ + shared vae/, text_encoder/, scheduler/).

ModelTaskVariantStepsHugging Face
Mage-Flow-4B-Basetext→imageBase30🤗 microsoft/Mage-Flow-Base
Mage-Flow-4Btext→imageRL-aligned20🤗 microsoft/Mage-Flow
Mage-Flow-4B-Turbotext→imageFew-step distilled4🤗 microsoft/Mage-Flow-Turbo
Mage-Flow-Edit-4B-BaseeditingBase30🤗 microsoft/Mage-Flow-Edit-Base
Mage-Flow-Edit-4BeditingRL-aligned30🤗 microsoft/Mage-Flow-Edit
Mage-Flow-Edit-4B-TurboeditingFew-step distilled4🤗 microsoft/Mage-Flow-Edit-Turbo

🖼️ Showcase

Text-to-image — prompt following, fine detail, and legible English/Chinese text rendering. (The first panel is open; click a title to expand the others.)

Instruction-based editing — appearance, content, scene/subject, human-centered & creative, low-level, and restoration edits (source → result). (The first panel is open; click a title to expand the others.)

📊 Performance

Text-to-image — full benchmark suite: GenEval, DPG-Bench, TIIF-Bench (short/long splits), CVTG-2K, OneIG (EN/CN), LongText (EN/CN). Higher is better; GenEval / CVTG-2K / OneIG / LongText on a 0–1 scale, DPG / TIIF on 0–100. The Type column marks closed- vs open-source; bold / underline = best / second-best among open-source models (closed-source shown for reference, not ranked); – = not reported; ★ = ours.

ModelType#ParamsStepsGenEvalDPGTIIF-ShortTIIF-LongCVTG-2KOneIG-ENOneIG-CNLongText-ENLongText-CN
Seedream 3.0Closed––0.8488.2786.0284.310.5920.5300.5280.8960.878
Seedream 4.0Closed––0.8488.63––0.8920.5730.5540.9360.946
GPT-Image-1Closed––0.8485.1589.1588.290.8570.5330.4740.9560.619
Nano-Banana-ProClosed––0.8387.16––0.7790.5800.5700.9810.949
FLUX.1-devOpen12B500.6683.8471.0971.780.4960.4340.2450.6070.005
FLUX.1-Krea-devOpen12B500.7286.5980.3681.670.4440.4430.2710.6930.002
FLUX.2-devOpen32B500.8787.5788.8288.100.8930.5510.5160.9630.757
FLUX.2-Klein-Base-4BOpen4B500.7883.0279.9480.010.6560.4850.3660.5540.071
FLUX.2-Klein-Base-9BOpen9B500.8385.2981.4784.520.6550.5440.4000.8720.227
FLUX.2-Klein-4BOpen4B40.8385.5378.9179.040.6280.5000.3640.6490.068
FLUX.2-Klein-9BOpen9B40.8686.2085.2284.130.4240.5380.4060.8720.226
Qwen-ImageOpen20B500.8788.3286.1486.830.8290.5390.5480.9430.946
JoyAI-ImageOpen16B50–88.05––0.8740.5420.5210.9630.963
HunyuanImage-3.0Open80B500.7286.10––0.765––––
LongCat-ImageOpen6B500.8786.8080.9381.300.8660.5160.5180.8850.956
Z-Image-BaseOpen6B500.8488.1480.2083.040.8670.5460.5350.9350.936
Z-Image-TurboOpen6B80.8284.8677.7380.050.8590.5280.5070.9170.926
Mage-Flow-Base ★Open4B300.7986.2682.5083.190.8510.5420.5090.9040.792
Mage-Flow ★Open4B200.9086.4982.1984.700.8870.5360.5050.9440.823
Mage-Flow-Turbo ★Open4B40.8885.4883.5884.160.8730.5230.4910.9110.801

Image editing — ImgEdit-Bench (0–5), GEdit-Bench EN/CN (0–10), TextEdit-Bench synthetic/real (0–25). Higher is better; the Type column marks closed- vs open-source; bold / underline = best / second-best among open-source models; – = not reported; ★ = ours.

ModelType#ParamsStepsImgEditGEdit-ENGEdit-CNTextEdit-SynTextEdit-Real
Nano-BananaClosed––4.297.2917.39916.5418.22
Seedream 4.0Closed––4.307.7017.69214.9018.54
Seedream 4.5Closed––4.327.8207.800––
Nano-Banana-ProClosed––4.377.7387.799––
Step1X-Edit-v1.2Open19B503.957.4807.4679.2612.02
FLUX.1-Kontext-devOpen12B283.716.4621.85712.1414.31
FLUX.2-devOpen32B504.357.4137.27811.8614.71
FLUX.2-Klein-Base-4BOpen4B503.807.0817.10211.0113.79
FLUX.2-Klein-4BOpen4B44.017.7177.75011.8414.46
FLUX.2-Klein-Base-9BOpen9B504.057.7407.74512.7615.65
FLUX.2-Klein-9BOpen9B44.188.0408.05512.7315.75
Z-Image-EditOpen6B504.307.5707.540––
Qwen-Image-Edit-2509Open20B504.317.4807.46713.4015.81
Qwen-Image-Edit-2511Open20B504.517.8777.81913.5316.81
LongCat-Image-EditOpen6B504.457.7487.73112.4614.89
FireRed-Image-Edit-1.0Open20B504.567.9437.88715.1917.23
JoyAI-Image-EditOpen16B504.468.2768.12514.8017.23
Mage-Flow-Edit-Base ★Open4B304.287.8607.97013.6315.57
Mage-Flow-Edit ★Open4B304.348.1278.12314.1416.26
Mage-Flow-Edit-Turbo ★Open4B44.388.2718.26412.7715.41

🏗️ Architecture

Mage-VAE — a latent tokenizer built as a symmetric one-step diffusion codec: the decoder is a fully-convolutional one-step pixel-diffusion model (no global-attention blocks), and the encoder is its architectural dual (a one-step latent generator conditioned on pixels). A standard Gaussian-prior KL is replaced with an anchor-latent KL that regularizes the posterior toward FLUX.2-VAE latents, giving a generation-ready 128-channel, 16×-downsampled latent space.

Mage-Flow — a 4B Multimodal DiT that encodes prompts with Qwen3-VL and images with Mage-VAE, then processes packed variable-length image+text sequences with per-sample 2D rotary embeddings and joint self-attention. Native-resolution packing removes bucket quantization and padding, lets one checkpoint generalize to any output size, and fuses the CFG cond/uncond branches into a single forward.

Post-training — from Base, generation is aligned with Diffusion-NFT (prompt following, aesthetics, text rendering, preference) to produce the RL model, and distilled with decoupled-DMD + adversarial perceptual guidance into the 4-step Turbo. Editing models reuse the recipe, trained on a mixture of generation and editing data to keep the generative prior.

🚀 Quick Start

Installation

Install everything except flash-attn first, then install flash-attn separately with build isolation off — it compiles a CUDA extension against your installed torch, so torch and a matching CUDA toolkit must already be present.

cd Mage/mage_flow
uv venv && source .venv/bin/activate

# 1) Pinned, tested dependency set (torch 2.13, transformers 5.5, diffusers 0.38, pillow 12.3, …).
#    Recommended for reproducibility. `uv pip install -e .` also works, but its loose
#    bounds may resolve to a newer torch/transformers than the code was tested against.
uv pip install -r requirements.txt
uv pip install -e . --no-deps           # the mage-flow package itself

# 2) flash-attn — needs build tools present and a CUDA toolkit whose MAJOR version
#    matches your torch build (e.g. torch cu12x ↔ nvcc 12.x). A cu13/nvcc-12 mix fails.
uv pip install setuptools wheel ninja
uv pip install --no-build-isolation flash-attn==2.8.3

Plain pip is equivalent (pip install -r requirements.txt, pip install -e . --no-deps, then the two flash-attn lines). This registers three commands: mage-flow, mage-flow-edit, mage-flow-app.

torch / CUDA: the default PyPI torch wheel targets the newest CUDA (currently cu13x). If your machine's CUDA toolkit is 12.x, install torch from the matching index first, e.g. uv pip install torch==2.13.0 torchvision==0.28.0 --index-url https://download.pytorch.org/whl/cu126, otherwise the flash-attn build will fail with a CUDA-version mismatch. (torch 2.13.0 ships cu126/cu129/cu130 wheels — pick the one matching your nvcc.)

Python API

pipe.generate(prompts, **kw) and pipe.edit(prompts, ref_images, **kw) return a list[PIL.Image] aligned with prompts. A prompts list is batched into one packed forward per denoise step (each sample can have its own resolution/seed).

Text-to-image:

from mage_flow import MageFlowPipeline

pipe = MageFlowPipeline.from_pretrained("microsoft/Mage-Flow", device="cuda")

# 1) single image
img = pipe.generate(["A close-up portrait of an elderly African man with deep wrinkles, wearing a traditional hat, soft natural lighting, ultra realistic."],
                    steps=20, cfg=5.0, heights=[1024], widths=[1024])[0]
img.save("t2i.png")

# 2) batch: several prompts / resolutions / seeds in ONE packed forward per step
imgs = pipe.generate(
    ["the Salar de Uyuni mirror surface captured at high noon, with intimate stillness permeating the air. dew beads on every blade of grass. National Geographic editorial, cinematic depth, fine-grained natural texture.", 
     "A close-up portrait of an elderly African man with deep wrinkles, wearing a traditional hat, soft natural lighting, ultra realistic.", 
     "An immersive close-up of a steaming bowl of Sichuan mapo tofu over jasmine rice served on a hand-thrown ceramic plate, finished with a wedge of citrus. Surface oils catch a tiny specular highlight. Shot with a Hasselblad H6D-100c, ambient window light, the kind of image that makes the viewer hungry."],
    heights=[512, 1024, 1792], widths=[2048, 1024, 1024],   # per-sample; 4:1 is fine
    seeds=[1, 2, 3], steps=20, cfg=5.0,
)

Image editing:

from mage_flow import MageFlowPipeline

pipe = MageFlowPipeline.from_pretrained("microsoft/Mage-Flow-Edit-Base", device="cuda")

# single reference (path or PIL image)
img = pipe.edit(["Replace the background with a field of sunflowers"], ["assets/dog.jpg"],
                steps=30, cfg=5.0, max_size=1024)[0]
img.save("single_edit.png")

# multi-image edit — ref_images[i] is a LIST of source images
img = pipe.edit(["blend the object from image 2 into image 1"],
                [["scene.png", "object.png"]], steps=30, cfg=5.0)[0]
img.save("multi_edit.png")

# explicit output size (overrides max_size); Turbo edit = 4 steps / cfg 1
img = pipe.edit(["Replace the background with a field of sunflowers"], ["assets/dog.jpg"],
                heights=[1024], widths=[1024], steps=4, cfg=1.0)[0]
img.save("single_edit_1024x1024.png")

Parameters (shared by generate / edit):

ParameterDefaultDescription
prompts—string or list of strings; a list is batched into one forward per step
ref_images (edit)—per prompt: one image/path, or alist of images for multi-image edit
steps30denoising steps — Base30, RL 20, Turbo 4
cfg5.0classifier-free guidance scale (Turbo:1.0)
heights, widths[1024]per-sample output size, multiple of 16; native resolution512–2048
max_size (edit)source sizelongest output side; short side follows the reference's aspect ratio
vl_cond_long_edge (edit)384cap the long edge of the reference image fed to theVL text encoder (matches training preprocessing; the VAE/generation path keeps the full output resolution). 0/None disables
neg_prompts" "per-sample negative prompt (applied whencfg > 1)
seeds42per-sample seed;-1 = random
batch_cfgTruefuse the CFG conditional + unconditional passes into one packed forward
renormalizationFalserescale guided velocity per token (reduces over-saturation at high cfg)
static_shift6.0override the flow-matching sigma shift
prompt_templatemage-flow / mage-flow-edittext-encoder prompt template

CLI

# text-to-image (two prompts in one batch)
mage-flow --prompt "A close-up portrait of an elderly African man with deep wrinkles, wearing a traditional hat, soft natural lighting, ultra realistic." "An immersive landscape of a Greenlandic icefjord at midnight sun, painted by early dawn light, crystal-clear skies adding drama. fine grains of sand carving sharp shadows. Peter Lik gallery print, moody atmosphere, museum-grade composition." \
          --model_path microsoft/Mage-Flow --steps 20 --cfg 5.0 \
          --height 1024 512 --width 1024 2048 --seed 42 --out ./outputs


# editing (one --ref per prompt; comma-separate sources for multi-image edit)
mage-flow-edit --prompt "Replace the background with a field of sunflowers" "blend these two images" \
               --ref assets/dog.jpg "scene.png,object.png" \
               --model_path microsoft/Mage-Flow-Edit --max_size 1024 --out ./outputs
FlagScopeMeaning
--promptbothone or more prompts, run as a batch (sample i uses --seed + i)
--model_pathbothlocal repo dir or HF Hub repo id (auto-downloaded + cached)
--stepsbothnumber of denoising steps
--cfgbothclassifier-free guidance scale
--heightbothoutput height — one value, or one per prompt for mixed resolutions
--widthbothoutput width — one value, or one per prompt for mixed resolutions
--seedbothbase seed (sample i uses --seed + i)
--neg_promptbothnegative prompt
--static_shiftbothoverride the flow-matching sigma shift
--outbothoutput directory
--refeditreference image per prompt (comma-separate paths for a multi-image edit)
--max_sizeeditmax size of the reference image
--vl_cond_long_edgeeditVL-condition long edge (default 384)

Gradio app

mage-flow-app                     # serve on http://0.0.0.0:7860  (or: python -m mage_flow.app)

A web UI with Text → Image and Image Edit tabs; models load lazily on first use and are cached. Presets default to the microsoft/Mage-Flow* Hugging Face repos (downloaded + cached on first use); set MAGEFLOW_HF_DIR to load local checkpoint dirs instead.

Launch options:

FlagDefaultMeaning
--host0.0.0.0bind address
--port7860port
--devicecudainference device
--shareoffcreate a public Gradio share link
--preload(lazy)comma-separated repo ids / paths to load at startup instead of on first use

📝 Citation

@article{zhang2026mageflow,
  title={Mage-Flow: An Efficient Native-Resolution Foundation Model for Image Generation and Editing},
  author={Zhang, Xinjie and Zhang, Peng and Zheng, Shicheng and Guo, Jinghao and Jia, Zhaoyang and Shen, Yifei and Guo, Xun and Luo, Yuxuan and Li, Jiahao and Xie, Wenxuan and Pu, Fanyi and Zhang, Xiaoyi and Zhang, Kaichen and Guo, Zongyu and Bi, Tianci and Gui, Dongnan and Liu, Zhening and Wen, Zimo and Zheng, Zihan and Yang, Senqiao and Li, Xiao and Wang, Jinglu and Li, Bin and Lu, Yan},
  journal={arXiv preprint arXiv:2607.19064},
  year={2026}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · diffusers

Нельзя запустить

Модели «картинка → картинка» пока не запускаются.

Ревизия весов
3039b72

0 моделей