| 🖼️ Image Generation | 👁️ Image Understanding | ✏️ Image Editing |
|---|---|---|
![]() |
![]() |
![]() |
Overall architecture of Mobile-O: a unified vision–language–diffusion model for on-device multimodal understanding and generation.
| 📱 iOS App Source Code | Mobile-O-App |
| 🧩 MLX & CoreML Models | 🤗 HuggingFace |
⚡ ~3-4s Image Generation • 👁️ ~0.4s Visual Understanding • 💾 < 2GB Memory Footprint
--- ## 📊 Training Datasets | Stage | Description | Download | |-------|-------------|----------| | **Pre-training** | 9M text-image pairs (JourneyDB+BLIP3o-Pretrain-Short-Caption) | [🤗 HuggingFace](https://huggingface.co/datasets/Amshaker/Mobile-O-Pre-Train) | | **SFT** | ~105K curated prompt-image pairs | [🤗 HuggingFace](https://huggingface.co/datasets/Amshaker/Mobile-O-SFT) | | **Post-training** | ~105K unified quadruplet samples | [🤗 HuggingFace](https://huggingface.co/datasets/Amshaker/Mobile-O-Post-Train) | --- ## ⚙️ Setup ```bash conda create -n mobileo python=3.12 -y conda activate mobileo pip install -r requirements.txt ``` --- ## 🚀 Inference ### Download Checkpoint ```bash python -c "from huggingface_hub import snapshot_download; print(snapshot_download(repo_id='Amshaker/Mobile-O-0.5B', repo_type='model', local_dir='checkpoints', allow_patterns=['final_merged_model_23620/*']))" ``` ### 1. Image Understanding ```bash python infer_image_understanding.py \ --model_path /HF_model/checkpoint/path/ \ --image_path assets/cute_cat.png \ --prompt "What is in the image?" ``` ### 2. Image Generation ```bash python infer_image_generation.py \ --model_path /HF_model/checkpoint/path/ \ --prompt "A vibrant tropical rainforest scene with a scarlet macaw perched on a moss-covered branch" ``` ### 3. Image Editing ```bash python infer_image_editing.py \ --model_path /HF_model/checkpoint/path/ \ --image_path assets/cute_cat.png \ --prompt "Make the cat wear a hat" ``` --- ## 🏋️ Training ### Stage 1: Pretraining (Cross-Modal Alignment) We pretrain the DiT and Mobile Conditioning Projector (MCP) components on 9M text-image pairs from [JourneyDB](https://journeydb.github.io/) (4M) and BLIP3o-Short-Caption (5M) using [data](https://huggingface.co/datasets/Amshaker/Mobile-O-Pre-Train). The visual encoders, LLM backbone, and VAE are frozen. ```bash bash scripts/Mobile-O-0.5B/pretrain.sh ``` ### Stage 2: Supervised Fine-tuning (SFT) We finetune the DiT and MCP components on ~105K curated prompt-image pairs (60K from BLIP3o + 45K from ShareGPT-4o-Image) using [data](https://huggingface.co/datasets/Amshaker/Mobile-O-SFT). The visual encoders, LLM backbone, and VAE remain frozen. ```bash bash scripts/Mobile-O-0.5B/sft.sh ``` ### Stage 3: Unified Multimodal Post-Training We post-train the DiT, MCP, LLM (via LoRA), and visual encoder components on ~105K quadruplet samples in the format *(generation prompt, image, question, answer)* using [data](https://huggingface.co/datasets/Amshaker/Mobile-O-Post-Train). Only the VAE remains frozen. ```bash bash scripts/Mobile-O-0.5B/post_train.sh ```
Unified multimodal post-training: jointly optimizing image generation and visual understanding via a multi-task objective.