Views
No views yet
1git clone https://huggingface.co/Jimmi42/MonkeyOCR-Apple-Silicon
2cd MonkeyOCR-Apple-Silicon1chmod +x setup.sh
2./setup.sh1# Install UV if not already installed
2curl -LsSf https://astral.sh/uv/install.sh | sh
3
4# Download MonkeyOCR
5git clone https://github.com/Yuliang-Liu/MonkeyOCR.git MonkeyOCR
6
7# Install dependencies (includes mlx-vlm)
8uv sync
9
10# Download models
11cd MonkeyOCR && python tools/download_model.py && cd ..1# Activate virtual environment
2source .venv/bin/activate # or `uv shell`
3
4# Start the web app
5python app.pyhttp://localhost:7861python main.py path/to/document.pdf1# model_configs_mps.yaml
2device: mps
3chat_config:
4 backend: auto # Smart auto-selection
5 batch_size: 1
6 max_new_tokens: 256
7 temperature: 0.0| Backend | Speed | Memory | Best For | Auto-Selected |
|---|---|---|---|---|
auto | ⚡ | 🧠 | All systems (Recommended) | ✅ Default |
mlx | 🚀🚀🚀 | 🟢 | Apple Silicon | 🍎 Auto for MPS |
lmdeploy | 🚀🚀 | 🟡 | CUDA systems | 🖥️ Auto for CUDA |
transformers | 🚀 | 🟢 | Universal fallback | 💻 Auto for CPU |
1# Test MLX-VLM availability
2python -c "import mlx_vlm; print('✅ MLX-VLM available')"
3
4# Check if auto backend selection is working
5python -c "
6from MonkeyOCR.magic_pdf.model.custom_model import MonkeyOCR
7model = MonkeyOCR('model_configs_mps.yaml')
8print(f'Selected backend: {type(model.chat_model).__name__}')
9"1# Check MPS availability
2python -c "import torch; print(f'MPS available: {torch.backends.mps.is_available()}')"
3
4# Monitor memory usage during processing
5top -pid $(pgrep -f "python app.py")./setup.sh to reapply patchesMonkeyOCR directory exists and has our modificationsMonkeyChat_MLX class exists in MonkeyOCR/magic_pdf/model/custom_model.pypython -c "import torch; print(torch.backends.mps.is_available())"pip install mlx-vlmbackend: mlx in config to force MLX backendbackend: auto in model_configs_mps.yamlGRADIO_SERVER_PORT=7862 python app.pyMonkeyOCR-MLX/
├── 🌐 app.py # Gradio web interface
├── 🖥️ main.py # CLI interface
├── ⚙️ model_configs_mps.yaml # MLX-optimized config
├── 📦 requirements.txt # Dependencies (includes mlx-vlm)
├── 🛠️ torch_patch.py # Compatibility patches
├── 🧠 MonkeyOCR/ # Core AI models
│ └── 🎯 magic_pdf/ # Processing engine
├── 📄 .gitignore # Git ignore rules
└── 📚 README.md # This fileMonkeyChat_MLX)git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)