Skip to content

NER using Huggingface model. Implementation of HF Tokeniser, Trainer and Pipeline.

Notifications You must be signed in to change notification settings

Arshad221b/Named-Entity-Recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Named-Entity-Recognition

Huggingface RoBERTa model implementation for NER on conll2003 dataset.

Flow of the program:

1. Importing data using Huggingface Dataset

2. Tokenisation of sentences

3. Importing pre-trained model from huggingface hub

4. Training the model using Trainer Fuction

5. Inference using Huggingface Pipeline

from transformers import pipeline
nlp = pipeline("ner", model=model_, tokenizer=tokenizer)
example = "My name is Wolfgang and I live in Berlin"

ner_results = nlp(example)
print(ner_results)

Ouput

[{'entity': 'B-PER', 'score': 0.84195936, 'index': 4, 'word': 'wolfgang', 'start': 11, 'end': 19}, {'entity': 'B-LOC', 'score': 0.9583987, 'index': 9, 'word': 'berlin', 'start': 34, 'end': 40}]

Entire Explanation :

https://arshad-kazi.com/ner-using-hugging-face-transformers/

Releases

No releases published

Packages

No packages published