Instructions to use d4data/biomedical-ner-all with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use d4data/biomedical-ner-all with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="d4data/biomedical-ner-all")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("d4data/biomedical-ner-all") model = AutoModelForTokenClassification.from_pretrained("d4data/biomedical-ner-all") - Inference
- Notebooks
- Google Colab
- Kaggle
get labels for entities
#5
by oanjum - opened
Hi,
I looked at the output of the model. It seems like giving labels at the token level. Could you please provide code that can give labels at the entity level instead word pieces / tokens?
Thanks
Hie, @oanjum
I am looking for the same, have you found anything?
Have you tested different values for aggregation_strategy parameter?
- "simple"
- "first"
- "max"
- "average"
For me "average" works great.
The code in the GitHub repo uses "max" (https://github.com/dreji18/Bio-Epidemiology-NER/blob/48d1c9a3faba3c01479737dfbfe3a60806c1f5aa/Bio_Epidemiology_NER/bio_recognizer.py#L40), and I find it solves the problem of classifying at the token level.