Transformers
OCR
Apple Silicon
MLX
MLX-VLM
Vision Language Model
Document Processing
Gradio
Apple M1
Apple M2
Apple M3
Apple M4
MonkeyOCR
Qwen2.5-VL
Run this model with HF Jobs
Run Jimmi42/MonkeyOCR-Apple-Silicon on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Jimmi42/MonkeyOCR-Apple-Silicon. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Jimmi42/MonkeyOCR-Apple-Silicon on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Jimmi42/MonkeyOCR-Apple-Silicon with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Jimmi42/MonkeyOCR-Apple-Silicon with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Jimmi42/MonkeyOCR-Apple-Silicon", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download torch_patch.py from Jimmi42/MonkeyOCR-Apple-Silicon: direct link, hf CLI and curl.
- Browser
- Download file 1.53 kB
-
https://huggingface.co/Jimmi42/MonkeyOCR-Apple-Silicon/resolve/main/torch_patch.py
- Command line
-
hf download hf://Jimmi42/MonkeyOCR-Apple-Silicon/torch_patch.py
-
curl -L -o torch_patch.py https://huggingface.co/Jimmi42/MonkeyOCR-Apple-Silicon/resolve/main/torch_patch.py
1.53 kB
| #!/usr/bin/env python3 | |
| """ | |
| Patch for PyTorch 2.7 weights_only issue with doclayout_yolo models | |
| This allows loading the YOLO model weights safely | |
| """ | |
| import torch | |
| import torch.serialization | |
| # Store original torch.load | |
| _original_torch_load = torch.load | |
| def patched_torch_load(*args, **kwargs): | |
| """Patched torch.load that defaults to weights_only=False for compatibility""" | |
| # If weights_only is not specified, set it to False for compatibility | |
| if 'weights_only' not in kwargs: | |
| kwargs['weights_only'] = False | |
| return _original_torch_load(*args, **kwargs) | |
| def patch_torch_load(): | |
| """Patch torch.load to allow doclayout_yolo classes""" | |
| try: | |
| # First try to add safe globals | |
| torch.serialization.add_safe_globals([ | |
| 'doclayout_yolo.nn.tasks.YOLOv10DetectionModel', | |
| 'doclayout_yolo.nn.modules.YOLOv10DetectionModel', | |
| 'ultralytics.nn.tasks.DetectionModel', | |
| 'ultralytics.nn.modules.Conv', | |
| 'ultralytics.nn.modules.C2f', | |
| 'ultralytics.nn.modules.SPPF', | |
| 'ultralytics.nn.modules.Detect', | |
| 'ultralytics.nn.modules.DFL', | |
| ]) | |
| print("✅ PyTorch safe globals added for doclayout_yolo") | |
| except Exception as e: | |
| print(f"⚠️ Safe globals failed: {e}") | |
| # Also monkey-patch torch.load to default to weights_only=False | |
| torch.load = patched_torch_load | |
| print("✅ PyTorch load function patched for compatibility") | |
| if __name__ == "__main__": | |
| patch_torch_load() |