Instructions to use roberthsu2003/models_for_ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use roberthsu2003/models_for_ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="roberthsu2003/models_for_ner")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("roberthsu2003/models_for_ner") model = AutoModelForTokenClassification.from_pretrained("roberthsu2003/models_for_ner") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -71,7 +71,9 @@ model = AutoModelForTokenClassification.from_pretrained('roberthsu2003/models_fo
|
|
| 71 |
tokenizer = AutoTokenizer.from_pretrained('roberthsu2003/models_for_ner')
|
| 72 |
|
| 73 |
# The label mapping (you might need to adjust this based on your training)
|
| 74 |
-
|
|
|
|
|
|
|
| 75 |
|
| 76 |
def predict_ner(text):
|
| 77 |
"""Predicts NER tags for a given text using the loaded model."""
|
|
|
|
| 71 |
tokenizer = AutoTokenizer.from_pretrained('roberthsu2003/models_for_ner')
|
| 72 |
|
| 73 |
# The label mapping (you might need to adjust this based on your training)
|
| 74 |
+
#['O', 'B-PER', 'I-PER', 'B-ORG', 'I-ORG', 'B-LOC', 'I-LOC']
|
| 75 |
+
label_list = list(model.config.id2label.values())
|
| 76 |
+
|
| 77 |
|
| 78 |
def predict_ner(text):
|
| 79 |
"""Predicts NER tags for a given text using the loaded model."""
|