| # GLM-OCR to CoreML conversion | |
| Notebooks and assets to convert [GLM-OCR](https://huggingface.co/aoiandroid/GLM-OCR) to CoreML for iOS/macOS. | |
| ## Contents | |
| - **glm_ocr_coreml_v4.ipynb** – Main conversion notebook (vision encoder + optional decoder, quantization, accuracy check). Use this. | |
| - **glm_ocr_coreml.ipynb** – Older notebook variant. | |
| - **glm_ocr_coreml_requirements.txt** – Python dependencies (Python 3.10+ recommended; transformers main branch required for GLM-OCR). | |
| ## Requirements | |
| - Python 3.10+ | |
| - PyTorch, transformers (from [main](https://github.com/huggingface/transformers)), coremltools 7.2+ | |
| ## Quick start | |
| 1. Create a venv with Python 3.10+ and install: | |
| ```bash | |
| pip install -r glm_ocr_coreml_requirements.txt | |
| pip install "git+https://github.com/huggingface/transformers.git@main" | |
| ``` | |
| 2. Open `glm_ocr_coreml_v4.ipynb` and run cells top to bottom. | |
| 3. Outputs go to `glm_ocr_coreml/` (vision_encoder.mlpackage, model_spec.json, etc.). | |
| ## Note | |
| - `.venv_glm_ocr` is not included; create your own venv with Python 3.10+. | |
| - Converted `.mlpackage` files can be uploaded separately if needed (they are large). | |