Token Classification
Transformers
PyTorch
TensorFlow
JAX
ONNX
Safetensors
English
bert
Eval Results (legacy)
Instructions to use dslim/bert-base-NER with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dslim/bert-base-NER with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="dslim/bert-base-NER")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER") model = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER") - Inference
- Notebooks
- Google Colab
- Kaggle
I need only one tag for one word.
#4
by Aamer - opened
Hi All
Can anyone help me with how to get only one tag with one word. I am getting ner_result with tags separated by '##'.
For example, Hi Aamer, are you in India?
It is giving result like: A: B-per, ##a: I-per, ##m: I-per, ##e and so on...
I need something like, Aamer: B-person, India: B-loc
Try calling the pipeline with aggregation_strategy="simple"
@cphoover You can find it in the documentation for the specific kind of pipeline that is returned from using pipeline('ner'...
https://huggingface.co/docs/transformers/v4.26.0/en/main_classes/pipelines#transformers.TokenClassificationPipeline
The aggregation_strategy option is not viable with all pipelines.