Instructions to use syubraj/spanish_bert_based_ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use syubraj/spanish_bert_based_ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="syubraj/spanish_bert_based_ner")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("syubraj/spanish_bert_based_ner") model = AutoModelForTokenClassification.from_pretrained("syubraj/spanish_bert_based_ner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
syubraj/espanyol_bert_based_ner
Browse files
README.md
CHANGED
|
@@ -7,18 +7,14 @@ tags:
|
|
| 7 |
model-index:
|
| 8 |
- name: fine_tune_bert_output
|
| 9 |
results: []
|
| 10 |
-
language:
|
| 11 |
-
- es
|
| 12 |
-
metrics:
|
| 13 |
-
- precision
|
| 14 |
-
- recall
|
| 15 |
-
- f1
|
| 16 |
-
pipeline_tag: token-classification
|
| 17 |
---
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
It achieves the following results on the evaluation set:
|
| 23 |
- Loss: 0.3320
|
| 24 |
- Overall Precision: 0.9051
|
|
@@ -28,63 +24,19 @@ It achieves the following results on the evaluation set:
|
|
| 28 |
- Loc F1: 0.9190
|
| 29 |
- Org F1: 0.8663
|
| 30 |
- Per F1: 0.9367
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
- **O**: Outside of a named entity.
|
| 45 |
-
- **B-PER**: Beginning of a person's name.
|
| 46 |
-
- **I-PER**: Inside a person's name.
|
| 47 |
-
- **B-ORG**: Beginning of an organization's name.
|
| 48 |
-
- **I-ORG**: Inside an organization's name.
|
| 49 |
-
- **B-LOC**: Beginning of a location name.
|
| 50 |
-
- **I-LOC**: Inside a location name.
|
| 51 |
-
|
| 52 |
-
## Intended Use
|
| 53 |
-
- Text analysis for structured information extraction.
|
| 54 |
-
- Applications like document parsing, chatbots, or customer service systems.
|
| 55 |
-
## Inference Example
|
| 56 |
-
|
| 57 |
-
```python
|
| 58 |
-
from transformers import AutoModelForTokenClassification, AutoTokenizer, pipeline
|
| 59 |
-
|
| 60 |
-
# Load the model and tokenizer
|
| 61 |
-
model_name = "syubraj/espanyol_bert_based_ner"
|
| 62 |
-
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
| 63 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 64 |
-
|
| 65 |
-
# The custom label mapping
|
| 66 |
-
custom_label_mapping = {
|
| 67 |
-
0: 'O',
|
| 68 |
-
1: 'B-PER',
|
| 69 |
-
2: 'I-PER',
|
| 70 |
-
3: 'B-ORG',
|
| 71 |
-
4: 'I-ORG',
|
| 72 |
-
5: 'B-LOC',
|
| 73 |
-
6: 'I-LOC',
|
| 74 |
-
}
|
| 75 |
-
ner_pipeline = pipeline("ner", model=model, tokenizer=tokenizer)
|
| 76 |
-
|
| 77 |
-
# Sample Spanish text
|
| 78 |
-
text = "Donald trabaja en Twitter"
|
| 79 |
-
|
| 80 |
-
raw_results = ner_pipeline(text)
|
| 81 |
-
|
| 82 |
-
for entity in raw_results:
|
| 83 |
-
label_index = int(entity['entity'].split('_')[1])
|
| 84 |
-
entity_label = custom_label_mapping.get(label_index, "UNKNOWN")
|
| 85 |
-
print(f"Word: {entity['word']}, Label: {entity_label}")
|
| 86 |
-
|
| 87 |
-
```
|
| 88 |
## Training procedure
|
| 89 |
|
| 90 |
### Training hyperparameters
|
|
@@ -121,4 +73,4 @@ The following hyperparameters were used during training:
|
|
| 121 |
- Transformers 4.44.2
|
| 122 |
- Pytorch 2.4.1+cu121
|
| 123 |
- Datasets 3.2.0
|
| 124 |
-
- Tokenizers 0.19.1
|
|
|
|
| 7 |
model-index:
|
| 8 |
- name: fine_tune_bert_output
|
| 9 |
results: []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 13 |
+
should probably proofread and complete it, then remove this comment. -->
|
| 14 |
|
| 15 |
+
# fine_tune_bert_output
|
| 16 |
+
|
| 17 |
+
This model is a fine-tuned version of [bert-base-multilingual-cased](https://huggingface.co/bert-base-multilingual-cased) on an unknown dataset.
|
| 18 |
It achieves the following results on the evaluation set:
|
| 19 |
- Loss: 0.3320
|
| 20 |
- Overall Precision: 0.9051
|
|
|
|
| 24 |
- Loc F1: 0.9190
|
| 25 |
- Org F1: 0.8663
|
| 26 |
- Per F1: 0.9367
|
| 27 |
+
|
| 28 |
+
## Model description
|
| 29 |
+
|
| 30 |
+
More information needed
|
| 31 |
+
|
| 32 |
+
## Intended uses & limitations
|
| 33 |
+
|
| 34 |
+
More information needed
|
| 35 |
+
|
| 36 |
+
## Training and evaluation data
|
| 37 |
+
|
| 38 |
+
More information needed
|
| 39 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
## Training procedure
|
| 41 |
|
| 42 |
### Training hyperparameters
|
|
|
|
| 73 |
- Transformers 4.44.2
|
| 74 |
- Pytorch 2.4.1+cu121
|
| 75 |
- Datasets 3.2.0
|
| 76 |
+
- Tokenizers 0.19.1
|