eriktks/conll2003
Updated • 30.3k • 177
How to use MrRobson9/gpt2-ner-conll2003-english with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("token-classification", model="MrRobson9/gpt2-ner-conll2003-english") # Load model directly
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("MrRobson9/gpt2-ner-conll2003-english")
model = AutoModelForTokenClassification.from_pretrained("MrRobson9/gpt2-ner-conll2003-english", device_map="auto")This model is a fine-tuned version of GPT-2 on the CoNLL2003 dataset for Named Entity Recognition (NER) in English. The CoNLL2003 dataset contains four types of named entities: Person (PER), Location (LOC), Organization (ORG), and Miscellaneous (MISC).
This model is ideal for tasks that require identifying and classifying named entities within English text, such as:
To use this model in your code, you can load it via Hugging Face’s Transformers library:
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline
tokenizer = AutoTokenizer.from_pretrained("MrRobson9/gpt2-ner-conll2003-english")
model = AutoModelForTokenClassification.from_pretrained("MrRobson9/gpt2-ner-conll2003-english")
nlp_ner = pipeline("ner", model=model, tokenizer=tokenizer)
result = nlp_ner("John lives in New York and works for the United Nations.")
print(result)
| accuracy | precision | recall | f1-score |
|---|---|---|---|
| 0.973 | 0.783 | 0.840 | 0.810 |
This model is licensed under the same terms as the GPT-2 model and the CoNLL2003 dataset. Please ensure compliance with all respective licenses when using this model.
Base model
openai-community/gpt2