Views
No views yet
1from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
2
3tokenizer = AutoTokenizer.from_pretrained("JoshuaAAX/bert-finetuned-ner")
4model = AutoModelForTokenClassification.from_pretrained("JoshuaAAX/bert-finetuned-ner")
5
6
7text = "La Federación nacional de cafeteros de Colombia es una entidad del estado. El primer presidente el Dr Augusto Guerra contó con el aval de la Asociación Colombiana de Aviación."
8
9
10ner_pipeline= pipeline("ner", model=model, tokenizer=tokenizer, aggregation_strategy="max")
11ner_pipeline(text) | Abbreviation | Description |
|---|---|
| O | Outside of NE |
| PER | Person’s name |
| ORG | Organization |
| LOC | Location |
| MISC | Miscellaneous |
| Training Loss | Epoch | Step | Validation Loss | Precision | Recall | F1 | Accuracy |
|---|---|---|---|---|---|---|---|
| 0.1713 | 1.0 | 521 | 0.1404 | 0.6859 | 0.7387 | 0.7114 | 0.9599 |
| 0.0761 | 2.0 | 1042 | 0.1404 | 0.6822 | 0.7693 | 0.7231 | 0.9623 |
| 0.05 | 3.0 | 1563 | 0.1304 | 0.7488 | 0.7937 | 0.7706 | 0.9672 |
| 0.0355 | 4.0 | 2084 | 0.1454 | 0.7585 | 0.7960 | 0.7768 | 0.9664 |
| 0.0253 | 5.0 | 2605 | 0.1501 | 0.7549 | 0.8095 | 0.7812 | 0.9677 |
| 0.0184 | 6.0 | 3126 | 0.1726 | 0.7581 | 0.7992 | 0.7781 | 0.9662 |
| 0.0138 | 7.0 | 3647 | 0.1743 | 0.7524 | 0.8042 | 0.7774 | 0.9676 |
| 0.0112 | 8.0 | 4168 | 0.1853 | 0.7576 | 0.8022 | 0.7792 | 0.9674 |
| 0.0082 | 9.0 | 4689 | 0.1914 | 0.7595 | 0.8061 | 0.7821 | 0.9667 |
| 0.0073 | 10.0 | 5210 | 0.1912 | 0.7641 | 0.8088 | 0.7858 | 0.9677 |