Instructions to use TypicaAI/magbert-ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TypicaAI/magbert-ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="TypicaAI/magbert-ner")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("TypicaAI/magbert-ner") model = AutoModelForTokenClassification.from_pretrained("TypicaAI/magbert-ner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Migrate model card from transformers-repo
Browse filesRead announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/TypicaAI/magbert-ner/README.md
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: fr
|
| 3 |
+
widget:
|
| 4 |
+
- text: "Je m'appelle Hicham et je vis a Fès"
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# MagBERT-NER: a state-of-the-art NER model for Moroccan French language (Maghreb)
|
| 8 |
+
|
| 9 |
+
## Introduction
|
| 10 |
+
|
| 11 |
+
[MagBERT-NER] is a state-of-the-art NER model for Moroccan French language (Maghreb). The MagBERT-NER model was fine-tuned for NER Task based the language model for French Camembert (based on the RoBERTa architecture).
|
| 12 |
+
|
| 13 |
+
For further information or requests, please visite our website at [typica.ai Website](https://typica.ai/) or send us an email at contactus@typica.ai
|
| 14 |
+
|
| 15 |
+
## How to use MagBERT-NER with HuggingFace
|
| 16 |
+
|
| 17 |
+
##### Load MagBERT-NER and its sub-word tokenizer :
|
| 18 |
+
|
| 19 |
+
```python
|
| 20 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
| 21 |
+
|
| 22 |
+
tokenizer = AutoTokenizer.from_pretrained("TypicaAI/magbert-ner")
|
| 23 |
+
model = AutoModelForTokenClassification.from_pretrained("TypicaAI/magbert-ner")
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
##### Process text sample (from wikipedia about the current Prime Minister of Morocco) Using NER pipeline
|
| 27 |
+
|
| 28 |
+
from transformers import pipeline
|
| 29 |
+
|
| 30 |
+
nlp = pipeline('ner', model=model, tokenizer=tokenizer, grouped_entities=True)
|
| 31 |
+
nlp("Saad Dine El Otmani, né le 16 janvier 1956 à Inezgane, est un homme d'État marocain, chef du gouvernement du Maroc depuis le 5 avril 2017")
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
#[{'entity_group': 'I-PERSON',
|
| 35 |
+
# 'score': 0.8941445276141167,
|
| 36 |
+
# 'word': 'Saad Dine El Otmani'},
|
| 37 |
+
# {'entity_group': 'B-DATE',
|
| 38 |
+
# 'score': 0.5967703461647034,
|
| 39 |
+
# 'word': '16 janvier 1956'},
|
| 40 |
+
# {'entity_group': 'B-GPE', 'score': 0.7160899192094803, 'word': 'Inezgane'},
|
| 41 |
+
# {'entity_group': 'B-NORP', 'score': 0.7971733212471008, 'word': 'marocain'},
|
| 42 |
+
# {'entity_group': 'B-GPE', 'score': 0.8921478390693665, 'word': 'Maroc'},
|
| 43 |
+
# {'entity_group': 'B-DATE',
|
| 44 |
+
# 'score': 0.5760444005330404,
|
| 45 |
+
# 'word': '5 avril 2017'}]
|
| 46 |
+
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
## Authors
|
| 51 |
+
|
| 52 |
+
MagBert-NER Model was trained by Hicham Assoudi, Ph.D.
|
| 53 |
+
For any questions, comments you can contact me at assoudi@typica.ai
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
## Citation
|
| 57 |
+
|
| 58 |
+
If you use our work, please cite:
|
| 59 |
+
Hicham Assoudi, Ph.D., MagBERT-NER: a state-of-the-art NER model for Moroccan French language (Maghreb), (2020)
|