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
File size: 2,016 Bytes
f0a6dc8 | 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | ---
license: apache-2.0
language:
- ar
base_model: google/embeddinggemma-2
library_name: transformers
pipeline_tag: feature-extraction
tags:
- arabic
- ocr
- document-ai
- word-matching
- multimodal-embedding
- embeddinggemma
datasets:
- seemorg/books-ocr
---
# ArabicWordsEmbedding
- Fine-tuned from [google/embeddinggemma-2](https://huggingface.co/google/embeddinggemma-2) (440M parameters with the
audio encoder removed).
## Training
- **Real data:** about 400k word crops from 3,000 scanned pages of classical Arabic printed books
([seemorg/books-ocr](https://huggingface.co/datasets/seemorg/books-ocr), human-reviewed transcriptions). Word boxes come from
Tesseract and are aligned to the transcription.
- **Synthetic data:** generated on the fly in about 50 fonts. Each word is rendered with full, partial or no tashkeel, attached
punctuation and neighbouring words, then cropped like a word detector would and degraded like a scan (low resolution, blur,
JPEG, binarisation, noise, rotation).
- **Objective:** contrastive (InfoNCE). Every batch contains lookalike words (same letters without dots), plus targeted pairs
where tashkeel or punctuation imitates a dot.
- **Method:** LoRA on the vision tower and the transformer, merged into this checkpoint.
## Limitations
- Trained and tested on **printed** Arabic book pages. Handwriting, scene text and decorative fonts were not evaluated.
- Real-data boxes came from Tesseract. A detector that cuts boxes very differently (much tighter, or several words per box)
may need a quick check.
- Short words that differ by one prefix letter (ل / ال / و) cause most of the remaining real errors.
- Matching inside one page is the intended use. Open-vocabulary recognition is weaker: 93.6% top-1 among 31.7k words.
## License
Apache 2.0, the same as the base model [google/embeddinggemma-2](https://huggingface.co/google/embeddinggemma-2).
Training pages come from [seemorg/books-ocr](https://huggingface.co/datasets/seemorg/books-ocr) (MIT).
|