Qwen-Image-Layered-MRP-MLX/src/mflux
Zimeng Xiong fe6936449d Add Qwen-Image-Layered support for image decomposition into RGBA layers
This PR adds support for the Qwen-Image-Layered model, which decomposes an input
image into semantically disentangled RGBA layers for layer-based editing workflows.

## Features
- New CLI command: \`mflux-generate-qwen-layered\`
- Decomposes images into N RGBA layers (default 4)
- Supports 6-bit quantization for ~29GB memory usage (vs 55GB BF16)
- Resolution buckets: 640 and 1024

## Architecture
- RGBA-VAE (4-channel) with 3D temporal convolutions for layer handling
- Layer3D RoPE: 3D positional encoding [layer, height, width]
- Uses base QwenTransformer with extended RoPE for multi-layer sequences
- Condition image encoded as layer_index=-1 for proper decomposition

## New Files
- \`src/mflux/models/qwen_layered/\` - Full model implementation
  - \`model/qwen_layered_vae/\` - RGBA-VAE encoder/decoder
  - \`model/qwen_layered_transformer/\` - Layer3D RoPE
  - \`weights/\` - Weight mapping and definitions
  - \`variants/i2l/\` - Image-to-Layers pipeline
  - \`cli/\` - Command-line interface

## Usage
\`\`\`sh
mflux-generate-qwen-layered \\
  --image input.png \\
  --layers 4 \\
  --steps 50 \\
  -q 6 \\
  --output-dir ./layers
\`\`\`

## Documentation
Added comprehensive documentation to README.md including:
- TOC entry
- CLI argument reference
- Usage examples and tips
- Memory requirements

Tested on M4 Max 48GB with 6-bit quantization.
2025-12-22 08:08:20 -08:00
..
assets Add support for Z-image Turbo & major improvements for weight loading and parameter resolution (#284) 2025-12-03 15:19:32 +01:00
callbacks Add support for Z-image Turbo & major improvements for weight loading and parameter resolution (#284) 2025-12-03 15:19:32 +01:00
cli Small LoRA improvements (#291) 2025-12-05 03:18:27 +01:00
models Add Qwen-Image-Layered support for image decomposition into RGBA layers 2025-12-22 08:08:20 -08:00
release Add Bria FIBO support (#279) 2025-11-27 13:01:55 +01:00
utils Add support for Z-image Turbo & major improvements for weight loading and parameter resolution (#284) 2025-12-03 15:19:32 +01:00
__init__.py Fix import 2025-12-03 22:50:02 +01:00