💜 Github | 🤗 Hugging Face | 📚 Cookbooks
🖥️ Demo
A powerful Arabic OCR model (proficient learner)
📌 Overview
This model is an advanced Arabic OCR system designed to combine deep linguistic understanding with high accuracy in visual text extraction.
The model was trained using a unique strategy focused on:
Reducing the model's active capacity during training Maintaining the stability of visual features Promoting genuine language understanding rather than rote memorization
🚀 Key Features
🔹 Model size: Approximately 2 GB 🔹 Performance: Outperforms much larger models in most tasks 🔹 Type: Robust learning model (requires fine-tuning for inference)
✅ Deep understanding of Arabic language context ✅ Intelligent spelling correction ✅ High visual accuracy in text extraction ✅ Noise reduction ✅ Highly stable training behavior ✅ Strong generalization on non-visual data 🧪 Evaluation Results Metric Value Evaluation loss 0.1041 Training-evaluation gap 0% - 2.5% Excellent stability
📌 This indicates near-perfect training equilibrium with minimal overshoot.
🧠 Training Philosophy
- Reduce Training Capacity
The model was trained using only half its capacity in order to:
Preserve visual representations Prevent image deterioration Improve overall stability 2. From "Memorizing Shapes" to "Learning Rules"
Instead of:
Memorizing word shapes
The model now learns:
Grammar rules and image-text relationships
- Controlling Inference
The training included:
Reducing excessive inference Limiting the linking of complex ideas Reverting processed information to its original size before output
🎯 Objective:
Forcing the model to accurately copy text instead of paraphrasing it
- Multilevel Reasoning Capability
The model was given internal inference capabilities during:
Reading the page Analyzing the text Generating output
This leads to:
Better understanding of invisible data Stronger real-world performance ⚙️ Inference Settings (Very Important)
⚠️ This is a powerful learner ← Requires precise control during inference
🎯 Use Cases 📄 OCR for Arabic books 📰 Text extraction from images 📚 Manuscript digitization 🧾 Document processing 🔍 Text enhancement after OCR ⚠️ Important Notes The model may attempt autocorrect if not properly constrained. To accurately copy text, use directives such as: Extract the text exactly as it is, without correction or paraphrasing.
📦 Why is the model small?
Despite its small size (approximately 2 GB), its outstanding performance is due to:
Effective training methodology Minimized cognitive noise Focus on patterns Significant Highly Efficient Representation Learning 🏁 Conclusion
This model achieves a rare balance between:
Visual Accuracy 👁️ Language Comprehension 🧠 Training Stability ⚖️
💡 It can be considered a sophisticated model for Arabic OCR, competing with larger systems.
| License | Model Size | Python |
|---|---|---|
| Apache-2.0 | 2.2GB | 3.12 |
⚠️ Important Notes
In some cases, the model may attempt to correct the text if it is not properly configured. For exact copying: Use a clear prompt such as: "Extract the text as is, without modification"
❌ Do not use high temperature settings → will cause hallucinations. ✅ Use "Restricted" settings for optimal accuracy. ✅ Best suited for OCR tasks, not creative writing. Send feedback Press tab for actions
Recommended Settings It includes:
with torch.no_grad():
generated_ids = model.generate( **inputs, max_new_tokens=512, # Keep repeating the loop do_sample=True, temperature=0.4, top_p=0.9, repetition_penalty=1.1
🖼️ Visualizations
| 🛠️ How to use it |