Instructions to use boda/ANER with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use boda/ANER with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="boda/ANER")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("boda/ANER") model = AutoModelForTokenClassification.from_pretrained("boda/ANER", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 568 Bytes
0e55bc2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from transformers import AutoModelForTokenClassification, AutoTokenizer
from helpers import helper
MODEL_NAME = 'boda/ANER'
# Load model and tokenizer
model = AutoModelForTokenClassification.from_pretrained('.')
tokenizer = AutoTokenizer.from_pretrained('.')
# change in the model labels
# model.config.id2label = {i: ' '+v+' ' for i, v in model.config.id2label.items() if i != 0 }
# model.config.id2label[0] = 'O'
# model.config.label2id = {label: i for i, label in model.config.id2label.items()}
# save model after finish
# model.save_pretrained('.')
|