Feature Extraction
Transformers
Safetensors
Arabic
embedding_gemma2
arabic
ocr
document-ai
word-matching
multimodal-embedding
embeddinggemma
Instructions to use g3ida/ArabicWordsEmbedding with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use g3ida/ArabicWordsEmbedding with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="g3ida/ArabicWordsEmbedding")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("g3ida/ArabicWordsEmbedding") model = AutoModel.from_pretrained("g3ida/ArabicWordsEmbedding", device_map="auto") - Notebooks
- Google Colab
- Kaggle
first commit
Browse files
README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- ar
|
| 5 |
+
base_model: google/embeddinggemma-2
|
| 6 |
+
library_name: transformers
|
| 7 |
+
pipeline_tag: feature-extraction
|
| 8 |
+
tags:
|
| 9 |
+
- arabic
|
| 10 |
+
- ocr
|
| 11 |
+
- document-ai
|
| 12 |
+
- word-matching
|
| 13 |
+
- multimodal-embedding
|
| 14 |
+
- embeddinggemma
|
| 15 |
+
datasets:
|
| 16 |
+
- seemorg/books-ocr
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# ArabicWordsEmbedding
|
| 20 |
+
|
| 21 |
+
- Fine-tuned from [google/embeddinggemma-2](https://huggingface.co/google/embeddinggemma-2) (440M parameters with the
|
| 22 |
+
audio encoder removed).
|
| 23 |
+
|
| 24 |
+
## Training
|
| 25 |
+
|
| 26 |
+
- **Real data:** about 400k word crops from 3,000 scanned pages of classical Arabic printed books
|
| 27 |
+
([seemorg/books-ocr](https://huggingface.co/datasets/seemorg/books-ocr), human-reviewed transcriptions). Word boxes come from
|
| 28 |
+
Tesseract and are aligned to the transcription.
|
| 29 |
+
- **Synthetic data:** generated on the fly in about 50 fonts. Each word is rendered with full, partial or no tashkeel, attached
|
| 30 |
+
punctuation and neighbouring words, then cropped like a word detector would and degraded like a scan (low resolution, blur,
|
| 31 |
+
JPEG, binarisation, noise, rotation).
|
| 32 |
+
- **Objective:** contrastive (InfoNCE). Every batch contains lookalike words (same letters without dots), plus targeted pairs
|
| 33 |
+
where tashkeel or punctuation imitates a dot.
|
| 34 |
+
- **Method:** LoRA on the vision tower and the transformer, merged into this checkpoint.
|
| 35 |
+
|
| 36 |
+
## Limitations
|
| 37 |
+
|
| 38 |
+
- Trained and tested on **printed** Arabic book pages. Handwriting, scene text and decorative fonts were not evaluated.
|
| 39 |
+
- Real-data boxes came from Tesseract. A detector that cuts boxes very differently (much tighter, or several words per box)
|
| 40 |
+
may need a quick check.
|
| 41 |
+
- Short words that differ by one prefix letter (ل / ال / و) cause most of the remaining real errors.
|
| 42 |
+
- Matching inside one page is the intended use. Open-vocabulary recognition is weaker: 93.6% top-1 among 31.7k words.
|
| 43 |
+
|
| 44 |
+
## License
|
| 45 |
+
|
| 46 |
+
Apache 2.0, the same as the base model [google/embeddinggemma-2](https://huggingface.co/google/embeddinggemma-2).
|
| 47 |
+
Training pages come from [seemorg/books-ocr](https://huggingface.co/datasets/seemorg/books-ocr) (MIT).
|