Update README.md
Browse files
README.md
CHANGED
|
@@ -10,6 +10,12 @@ metrics:
|
|
| 10 |
model-index:
|
| 11 |
- name: bert-base-spanish-analysis-app-questions
|
| 12 |
results: []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
|
@@ -17,7 +23,7 @@ should probably proofread and complete it, then remove this comment. -->
|
|
| 17 |
|
| 18 |
# bert-base-spanish-analysis-app-questions
|
| 19 |
|
| 20 |
-
This model is a fine-tuned version of [dccuchile/bert-base-spanish-wwm-uncased](https://huggingface.co/dccuchile/bert-base-spanish-wwm-uncased) on an
|
| 21 |
It achieves the following results on the evaluation set:
|
| 22 |
- Loss: 0.0004
|
| 23 |
- Accuracy: 1.0
|
|
@@ -27,17 +33,31 @@ It achieves the following results on the evaluation set:
|
|
| 27 |
|
| 28 |
## Model description
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
## Training and evaluation data
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
## Training procedure
|
| 41 |
|
| 42 |
### Training hyperparameters
|
| 43 |
|
|
@@ -72,3 +92,58 @@ The following hyperparameters were used during training:
|
|
| 72 |
- Pytorch 2.3.1+cu121
|
| 73 |
- Datasets 2.20.0
|
| 74 |
- Tokenizers 0.19.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
model-index:
|
| 11 |
- name: bert-base-spanish-analysis-app-questions
|
| 12 |
results: []
|
| 13 |
+
license: mit
|
| 14 |
+
datasets:
|
| 15 |
+
- devdroide/MiFirma-Ejemplo
|
| 16 |
+
language:
|
| 17 |
+
- es
|
| 18 |
+
pipeline_tag: text-classification
|
| 19 |
---
|
| 20 |
|
| 21 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
|
|
|
| 23 |
|
| 24 |
# bert-base-spanish-analysis-app-questions
|
| 25 |
|
| 26 |
+
This model is a fine-tuned version of [dccuchile/bert-base-spanish-wwm-uncased](https://huggingface.co/dccuchile/bert-base-spanish-wwm-uncased) on an [devdroide/MiFirma-Ejemplo](https://huggingface.co/datasets/devdroide/MiFirma-Ejemplo) dataset.
|
| 27 |
It achieves the following results on the evaluation set:
|
| 28 |
- Loss: 0.0004
|
| 29 |
- Accuracy: 1.0
|
|
|
|
| 33 |
|
| 34 |
## Model description
|
| 35 |
|
| 36 |
+
This model was fine-tuned for question classification in a fictitious app. List label from dataset:
|
| 37 |
+
|
| 38 |
+
* informacion_aplicacion
|
| 39 |
+
* Perfiles
|
| 40 |
+
* Perfil_adminsitrador
|
| 41 |
+
* Perfil_cliente
|
| 42 |
+
* Procesos
|
| 43 |
+
* Productos
|
| 44 |
+
* Personas_Firmantes
|
| 45 |
+
* Error_324
|
| 46 |
+
* Error_339
|
| 47 |
+
* Error_507
|
| 48 |
+
* Error_532
|
| 49 |
+
* Error_517
|
| 50 |
+
* Error_517_06
|
| 51 |
+
* Error_517_10
|
| 52 |
+
* Error_517_45
|
| 53 |
+
* Error_517_1120
|
| 54 |
+
* Error_301
|
| 55 |
+
|
| 56 |
+
### num_labels: 17
|
| 57 |
|
| 58 |
## Training and evaluation data
|
| 59 |
|
| 60 |
+
Set of frequently asked questions for an application. The set of questions consists of approximately 680 questions in Spanish. The set has the split of training, validation and testing.
|
|
|
|
|
|
|
| 61 |
|
| 62 |
### Training hyperparameters
|
| 63 |
|
|
|
|
| 92 |
- Pytorch 2.3.1+cu121
|
| 93 |
- Datasets 2.20.0
|
| 94 |
- Tokenizers 0.19.1
|
| 95 |
+
|
| 96 |
+
## Demo - Basic Usage
|
| 97 |
+
|
| 98 |
+
```python
|
| 99 |
+
# Colab
|
| 100 |
+
|
| 101 |
+
!pip install transformers
|
| 102 |
+
|
| 103 |
+
name_model = "devdroide/bert-base-spanish-analysis-app-questions"
|
| 104 |
+
|
| 105 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 106 |
+
tokenizer = AutoTokenizer.from_pretrained(name_model)
|
| 107 |
+
model = AutoModelForSequenceClassification.from_pretrained(name_model)
|
| 108 |
+
|
| 109 |
+
def classify_question(question):
|
| 110 |
+
inputs = tokenizer(question, padding=True, truncation=True, return_tensors="pt")
|
| 111 |
+
outputs = model(**inputs)
|
| 112 |
+
predictions = outputs.logits.argmax(dim=-1)
|
| 113 |
+
list_label = ['informacion_aplicacion', 'Perfiles', 'Perfil_adminsitrador', 'Perfil_cliente', 'Procesos', 'Productos', 'Personas_Firmantes', 'Error_324', 'Error_339', 'Error_507', 'Error_532', 'Error_517', 'Error_517_06', 'Error_517_10', 'Error_517_45', 'Error_517_1120', 'Error_301']
|
| 114 |
+
return list_label[predictions.item()]
|
| 115 |
+
|
| 116 |
+
questions = [
|
| 117 |
+
"驴Qu茅 es mi firma?",
|
| 118 |
+
"Hola, Al cliente le sali贸 en la aplicaci贸n el c贸digo de error 517:06 驴Cu谩l es la recomendaci贸n?",
|
| 119 |
+
"Buenas tardes 驴En la herramienta que perfiles hay?",
|
| 120 |
+
"Buenos d铆as, 驴Cu谩l es el listado de perfiles en la aplicaci贸n?",
|
| 121 |
+
"Buenas tardes al cliente le sali贸 el error 517 06 驴Cu谩l es la recomendaci贸n",
|
| 122 |
+
"Hola Tengo en la herramienta el c贸digo de error 517 驴Cu谩l es la recomendaci贸n?",
|
| 123 |
+
]
|
| 124 |
+
|
| 125 |
+
for question in questions:
|
| 126 |
+
category = classify_question(question)
|
| 127 |
+
print(f"Question: {question}")
|
| 128 |
+
print(f"Predicted category: {category}\n")
|
| 129 |
+
|
| 130 |
+
# Response example
|
| 131 |
+
# Question: 驴Qu茅 es mi firma?
|
| 132 |
+
# Predicted category: informacion_aplicacion
|
| 133 |
+
|
| 134 |
+
# uestion: Hola, Al cliente le sali贸 en la aplicaci贸n el c贸digo de error 517:06 驴Cu谩l es la recomendaci贸n?
|
| 135 |
+
# Predicted category: Error_517_06
|
| 136 |
+
|
| 137 |
+
# Question: Buenas tardes 驴En la herramienta que perfiles hay?
|
| 138 |
+
# Predicted category: Perfiles
|
| 139 |
+
|
| 140 |
+
# Question: Buenos d铆as, 驴Cu谩l es el listado de perfiles en la aplicaci贸n?
|
| 141 |
+
# Predicted category: Perfiles
|
| 142 |
+
|
| 143 |
+
# Question: Buenas tardes al cliente le sali贸 el error 517 06 驴Cu谩l es la recomendaci贸n
|
| 144 |
+
# Predicted category: Error_517_06
|
| 145 |
+
|
| 146 |
+
# Question: Hola Tengo en la herramienta el c贸digo de error 517 驴Cu谩l es la recomendaci贸n?
|
| 147 |
+
# Predicted category: Error_517
|
| 148 |
+
|
| 149 |
+
```
|