Instructions to use mohammad748/distilbert-conll2003-ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mohammad748/distilbert-conll2003-ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="mohammad748/distilbert-conll2003-ner")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("mohammad748/distilbert-conll2003-ner") model = AutoModelForTokenClassification.from_pretrained("mohammad748/distilbert-conll2003-ner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Create README.md
Browse files# DistilBERT for Named Entity Recognition
This project demonstrates fine-tuning **DistilBERT** for Named Entity Recognition (NER) using the **CoNLL-2003** dataset. The model is designed to detect and classify named entities in English text.
## Model Information
- **Pretrained Model:** distilbert-base-uncased
- **Dataset:** CoNLL-2003
- **Task:** Token Classification (NER)
- **Libraries:** PyTorch, Hugging Face Transformers
The model recognizes four main entity categories:
- **PER:** Person names
- **ORG:** Organizations
- **LOC:** Locations
- **MISC:** Miscellaneous entities
The predictions follow the BIO tagging scheme (`B-`, `I-`, and `O`) to distinguish entity boundaries.
## Using the Model
The fine-tuned model is available on Hugging Face Hub and can be used for inference with the `transformers` library.
```python
from transformers import pipeline
# Initialize the NER pipeline
ner = pipeline(
task="token-classification",
model="mohammad748/distilbert-conll2003-ner",
aggregation_strategy="simple"
)
# Sample sentence
text = "Microsoft was founded by Bill Gates and Paul Allen in the United States."
# Extract named entities
entities = ner(text)
for entity in entities:
print(entity)
```
The pipeline returns the detected entities along with their predicted categories, confidence scores, and character positions.
## Training Approach
The pretrained DistilBERT model was adapted to the NER task through supervised fine-tuning on CoNLL-2003. The process involved tokenization, label alignment, model training, and evaluation.
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
datasets:
|
| 4 |
+
- eriktks/conll2003
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
metrics:
|
| 8 |
+
- accuracy
|
| 9 |
+
base_model:
|
| 10 |
+
- distilbert/distilbert-base-uncased
|
| 11 |
+
pipeline_tag: token-classification
|
| 12 |
+
library_name: transformers
|
| 13 |
+
tags:
|
| 14 |
+
- ner
|
| 15 |
+
- named-entity-recognition
|
| 16 |
+
---
|