zsxkib/qwen-image-macos

🎨 Native AI image generation for Apple Silicon with Qwen-Image. Lightning LoRA acceleration for fast 4–8 step runs. Zero Docker, just works.

24

stars

35

commits

Python

primary language

Sep 15, 2025

updated

github.com/zsxkib/qwen-image-edit-macos
ai
apple-silicon
cli-tool
deep-learning
diffusion
image-generation
lightning-lora
m1
m2
m3
machine-learning
macos
mps
python
pytorch
qwen

README

🎨 Qwen Image for macOS

License Python 3.8+ macOS Apple Silicon

Fast AI image generation for Apple Silicon. Native CLI with MPS acceleration or containerized with Cog. Lightning LoRA for 4–8 step generation.

πŸš€ Quick Start

Choose your approach:

git clone https://github.com/zsxkib/qwen-image-macos.git
cd qwen-image-macos
pip install -r requirements.txt
python qwen.py generate "cyberpunk cityscape" --ultra-fast

Option B: Containerized with Cog (🐳 Reproducible - Works everywhere)

git clone https://github.com/zsxkib/qwen-image-macos.git
cd qwen-image-macos
python3 precache.py  # downloads model once (~10 min)
cog predict -i prompt="cyberpunk cityscape" --output city.png

Note: Cog runs ~30x slower on Apple Silicon (60+ min) due to x86_64 emulation. Use native CLI for speed, cog for reproducibility/deployment.

⚑ Performance Comparison

MethodTimePlatformGPUBest For
Native CLI2 minApple Siliconβœ… MPSSpeed, development
Cog (macOS)60+ minx86_64 emulation❌ CPU onlyReproducibility
Cog (Linux)~2-5 minNative x86_64βœ… CUDADeployment, cloud

🎯 Native CLI Usage

# Ultra-fast (4 steps with Lightning LoRA)
python qwen.py generate "cyberpunk cityscape" --ultra-fast

# Fast mode (8 steps)
python qwen.py generate "mountain landscape" --fast

# Custom settings
python qwen.py generate "robot on mars" --steps 20 --seed 42

# Test your setup
python qwen.py test

🧰 Requirements

  • Apple Silicon Mac (M1/M2/M3/M4)
  • Python 3.8+
  • 32GB+ RAM recommended (64GB+ ideal)

βœ… Features

  • Native MPS acceleration on macOS
  • Simple, single-file CLI (qwen.py)
  • Auto-opens generated image in Preview on macOS
  • Reproducible seeds and custom sizes

🐳 Cog Usage (Containerized)

Prerequisites:

  • Docker Desktop (macOS: increase memory to 64GB+ in Settings β†’ Resources)
  • Cog CLI: brew install replicate/cog/cog

Quick workflow:

# 1. Pre-download model (recommended, ~10 min)
python3 precache.py

# 2. Generate images
cog predict -i prompt="robot on mars" --output robot.png
cog predict -i prompt="cyberpunk city" -i steps=10 --output city.png

When to use cog:

  • βœ… Linux/NVIDIA: Fast with CUDA acceleration
  • βœ… Reproducible deployments: Exact same environment everywhere
  • βœ… Replicate cloud: Deploy to replicate.com
  • ❌ Apple Silicon: Use native CLI instead (30x faster)

πŸ”§ Technical Details

  • Model: Qwen-Image (57GB)
  • Acceleration: Lightning LoRA for 4-8 step generation
  • Memory: Attention slicing + VAE tiling for efficiency
  • Cache: Models stored in model_cache/ (~63GB)

πŸ› οΈ Troubleshooting

Check Apple Silicon GPU:

python -c "import torch; print('MPS available:', torch.backends.mps.is_available())"

Common fixes:

  • MPS not available β†’ Update macOS/PyTorch
  • Images look unfinished β†’ Increase --steps to 20-30
  • Cog OOM errors β†’ Increase Docker memory to 64GB+

πŸŽ† Example Output

Native CLI generates high-quality images in ~2 minutes:

Example


Built for Apple Silicon. Optimized for speed. Ready for deployment.

Contributors

zsxkib

35 commits

zsxkib/qwen-image-macos

🎨 Native AI image generation for Apple Silicon with Qwen-Image. Lightning LoRA acceleration for fast 4–8 step runs. Zero Docker, just works.

24

stars

35

commits

Python

primary language

Sep 15, 2025

updated

github.com/zsxkib/qwen-image-edit-macos
ai
apple-silicon
cli-tool
deep-learning
diffusion
image-generation
lightning-lora
m1
m2
m3
machine-learning
macos
mps
python
pytorch
qwen

README

🎨 Qwen Image for macOS

License Python 3.8+ macOS Apple Silicon

Fast AI image generation for Apple Silicon. Native CLI with MPS acceleration or containerized with Cog. Lightning LoRA for 4–8 step generation.

πŸš€ Quick Start

Choose your approach:

git clone https://github.com/zsxkib/qwen-image-macos.git
cd qwen-image-macos
pip install -r requirements.txt
python qwen.py generate "cyberpunk cityscape" --ultra-fast

Option B: Containerized with Cog (🐳 Reproducible - Works everywhere)

git clone https://github.com/zsxkib/qwen-image-macos.git
cd qwen-image-macos
python3 precache.py  # downloads model once (~10 min)
cog predict -i prompt="cyberpunk cityscape" --output city.png

Note: Cog runs ~30x slower on Apple Silicon (60+ min) due to x86_64 emulation. Use native CLI for speed, cog for reproducibility/deployment.

⚑ Performance Comparison

MethodTimePlatformGPUBest For
Native CLI2 minApple Siliconβœ… MPSSpeed, development
Cog (macOS)60+ minx86_64 emulation❌ CPU onlyReproducibility
Cog (Linux)~2-5 minNative x86_64βœ… CUDADeployment, cloud

🎯 Native CLI Usage

# Ultra-fast (4 steps with Lightning LoRA)
python qwen.py generate "cyberpunk cityscape" --ultra-fast

# Fast mode (8 steps)
python qwen.py generate "mountain landscape" --fast

# Custom settings
python qwen.py generate "robot on mars" --steps 20 --seed 42

# Test your setup
python qwen.py test

🧰 Requirements

  • Apple Silicon Mac (M1/M2/M3/M4)
  • Python 3.8+
  • 32GB+ RAM recommended (64GB+ ideal)

βœ… Features

  • Native MPS acceleration on macOS
  • Simple, single-file CLI (qwen.py)
  • Auto-opens generated image in Preview on macOS
  • Reproducible seeds and custom sizes

🐳 Cog Usage (Containerized)

Prerequisites:

  • Docker Desktop (macOS: increase memory to 64GB+ in Settings β†’ Resources)
  • Cog CLI: brew install replicate/cog/cog

Quick workflow:

# 1. Pre-download model (recommended, ~10 min)
python3 precache.py

# 2. Generate images
cog predict -i prompt="robot on mars" --output robot.png
cog predict -i prompt="cyberpunk city" -i steps=10 --output city.png

When to use cog:

  • βœ… Linux/NVIDIA: Fast with CUDA acceleration
  • βœ… Reproducible deployments: Exact same environment everywhere
  • βœ… Replicate cloud: Deploy to replicate.com
  • ❌ Apple Silicon: Use native CLI instead (30x faster)

πŸ”§ Technical Details

  • Model: Qwen-Image (57GB)
  • Acceleration: Lightning LoRA for 4-8 step generation
  • Memory: Attention slicing + VAE tiling for efficiency
  • Cache: Models stored in model_cache/ (~63GB)

πŸ› οΈ Troubleshooting

Check Apple Silicon GPU:

python -c "import torch; print('MPS available:', torch.backends.mps.is_available())"

Common fixes:

  • MPS not available β†’ Update macOS/PyTorch
  • Images look unfinished β†’ Increase --steps to 20-30
  • Cog OOM errors β†’ Increase Docker memory to 64GB+

πŸŽ† Example Output

Native CLI generates high-quality images in ~2 minutes:

Example


Built for Apple Silicon. Optimized for speed. Ready for deployment.

Contributors

zsxkib

35 commits

Languages

Python

90.4%

Shell

9.6%