Instructions to use dslim/distilbert-NER with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dslim/distilbert-NER with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="dslim/distilbert-NER")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("dslim/distilbert-NER") model = AutoModelForTokenClassification.from_pretrained("dslim/distilbert-NER", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Commit ·
9fb26d1
1
Parent(s): 2be6cea
Fix config to use the correct B/I/O label names
Browse filesToken labels were previously configured as generic LABEL_0 to LABEL_8; changed to the correct B/I/O tags so transformers ner pipeline can correctly aggregate the tokens into chunks.
Files changed (2)
- config.json+18-18
- onnx/config.json+18-18
8 unmodified lines910111213141516171819202122232425262728293031323334358 unmodified lines"dropout": 0.1,"hidden_dim": 3072,"id2label": {"0": "LABEL_0","1": "LABEL_1","2": "LABEL_2","3": "LABEL_3","4": "LABEL_4","5": "LABEL_5","6": "LABEL_6","7": "LABEL_7","8": "LABEL_8"},"initializer_range": 0.02,"label2id": {"LABEL_0": 0,"LABEL_1": 1,"LABEL_2": 2,"LABEL_3": 3,"LABEL_4": 4,"LABEL_5": 5,"LABEL_6": 6,"LABEL_7": 7,"LABEL_8": 8},"max_position_embeddings": 512,"model_type": "distilbert",8 unmodified lines910111213141516171819202122232425262728293031323334358 unmodified lines"dropout": 0.1,"hidden_dim": 3072,"id2label": {"0": "O","1": "B-PER","2": "I-PER","3": "B-ORG","4": "I-ORG","5": "B-LOC","6": "I-LOC","7": "B-MISC","8": "I-MISC"},"initializer_range": 0.02,"label2id": {"O": 0,"B-PER": 1,"I-PER": 2,"B-ORG": 3,"I-ORG": 4,"B-LOC": 5,"I-LOC": 6,"B-MISC": 7,"I-MISC": 8},"max_position_embeddings": 512,"model_type": "distilbert",
8 unmodified lines910111213141516171819202122232425262728293031323334358 unmodified lines"dropout": 0.1,"hidden_dim": 3072,"id2label": {"0": "LABEL_0","1": "LABEL_1","2": "LABEL_2","3": "LABEL_3","4": "LABEL_4","5": "LABEL_5","6": "LABEL_6","7": "LABEL_7","8": "LABEL_8"},"initializer_range": 0.02,"label2id": {"LABEL_0": 0,"LABEL_1": 1,"LABEL_2": 2,"LABEL_3": 3,"LABEL_4": 4,"LABEL_5": 5,"LABEL_6": 6,"LABEL_7": 7,"LABEL_8": 8},"max_position_embeddings": 512,"model_type": "distilbert",8 unmodified lines910111213141516171819202122232425262728293031323334358 unmodified lines"dropout": 0.1,"hidden_dim": 3072,"id2label": {"0": "O","1": "B-PER","2": "I-PER","3": "B-ORG","4": "I-ORG","5": "B-LOC","6": "I-LOC","7": "B-MISC","8": "I-MISC"},"initializer_range": 0.02,"label2id": {"O": 0,"B-PER": 1,"I-PER": 2,"B-ORG": 3,"I-ORG": 4,"B-LOC": 5,"I-LOC": 6,"B-MISC": 7,"I-MISC": 8},"max_position_embeddings": 512,"model_type": "distilbert",
config.json+18-18
onnx/config.json+18-18