Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GLM-OCR to CoreML conversion
|
| 2 |
+
|
| 3 |
+
Notebooks and assets to convert [GLM-OCR](https://huggingface.co/aoiandroid/GLM-OCR) to CoreML for iOS/macOS.
|
| 4 |
+
|
| 5 |
+
## Contents
|
| 6 |
+
|
| 7 |
+
- **glm_ocr_coreml_v4.ipynb** – Main conversion notebook (vision encoder + optional decoder, quantization, accuracy check). Use this.
|
| 8 |
+
- **glm_ocr_coreml.ipynb** – Older notebook variant.
|
| 9 |
+
- **glm_ocr_coreml_requirements.txt** – Python dependencies (Python 3.10+ recommended; transformers main branch required for GLM-OCR).
|
| 10 |
+
|
| 11 |
+
## Requirements
|
| 12 |
+
|
| 13 |
+
- Python 3.10+
|
| 14 |
+
- PyTorch, transformers (from [main](https://github.com/huggingface/transformers)), coremltools 7.2+
|
| 15 |
+
|
| 16 |
+
## Quick start
|
| 17 |
+
|
| 18 |
+
1. Create a venv with Python 3.10+ and install:
|
| 19 |
+
```bash
|
| 20 |
+
pip install -r glm_ocr_coreml_requirements.txt
|
| 21 |
+
pip install "git+https://github.com/huggingface/transformers.git@main"
|
| 22 |
+
```
|
| 23 |
+
2. Open `glm_ocr_coreml_v4.ipynb` and run cells top to bottom.
|
| 24 |
+
3. Outputs go to `glm_ocr_coreml/` (vision_encoder.mlpackage, model_spec.json, etc.).
|
| 25 |
+
|
| 26 |
+
## Note
|
| 27 |
+
|
| 28 |
+
- `.venv_glm_ocr` is not included; create your own venv with Python 3.10+.
|
| 29 |
+
- Converted `.mlpackage` files can be uploaded separately if needed (they are large).
|