File size: 1,145 Bytes
b489089
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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).