How microsoft/mage works
Mage is a two-branch multimodal model family: Mage-Flow generates images from prompts and edits supplied images, while Mage-VL handles image/video understanding and proactive streaming commentary. The Flow app and inference interface feed a shared pipeline that screens and conditions requests, runs the generative model, and returns images. Its model combines a text encoder, VAE, diffusion transformer, and attention kernels. Mage-VL’s two inference scripts are represented as separate user-facing capabilities; the README documents their behavior, but their internal call structure was not sampled.
Main entry points: pipeline.py Generation pipeline · mage_flow.py Flow model · text_encoder.py Text encoder · app.py Gradio app
Components 16
Mage-Flow interfaces
- Gradio app
mage_flow/app.py - CLI inference
mage_flow/inference.py
Flow generation runtime
- Generation pipeline
mage_flow/pipeline.py
Flow model stack
- Flow model
mage_flow/models/mage_flow.py - Text screening
mage_flow/models/modules/text_encoder.py - Text encoder
mage_flow/models/modules/text_encoder.py - Mage VAE
mage_flow/models/modules/mage_vae.py - Transformer layers
mage_flow/models/modules/mage_layers.py - Attention backend
mage_flow/models/modules/_attn_backend.py - Text components
mage_flow/models/modules/mage_text.py - Latent tools
mage_flow/models/modules/mage_latent.py - Model utilities
mage_flow/models/utils.py
Mage-VL inference
- Image/video understanding
mage_vl/inference_base.py - Proactive streaming
mage_vl/inference_streaming.py
Other components
- Image creator
- Image/video user
Connections 16
- Image creator → Gradio app: uses
- Image creator → CLI inference: invokes
- Gradio app → Generation pipeline: calls
mage_flow/app.py - Generation pipeline → Text screening: screens prompts
mage_flow/pipeline.py - Generation pipeline → Text encoder: encodes conditioning
mage_flow/pipeline.py - Generation pipeline → Flow model: loads model
mage_flow/pipeline.py - Flow model → Text encoder: uses
mage_flow/models/mage_flow.py - Flow model → Mage VAE: loads
mage_flow/models/mage_flow.py - Flow model → Transformer layers: uses
mage_flow/models/mage_flow.py - Flow model → Attention backend: selects backend
mage_flow/models/mage_flow.py - Text encoder → Text components: uses
mage_flow/models/modules/text_encoder.py - Transformer layers → Attention backend: dispatches attention
mage_flow/models/modules/mage_layers.py - Generation pipeline → Latent tools: uses
mage_flow/pipeline.py - Generation pipeline → Model utilities: uses
mage_flow/pipeline.py - Image/video user → Image/video understanding: requests understanding
README.md - Image/video user → Proactive streaming: requests commentary
README.md