Update README.md
Browse files
README.md
CHANGED
@@ -7,4 +7,106 @@ tags:
|
|
7 |
- chatbot
|
8 |
- conversational
|
9 |
inference: false
|
10 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
- chatbot
|
8 |
- conversational
|
9 |
inference: false
|
10 |
+
---
|
11 |
+
|
12 |
+
# Conversational Spanish GPT: Advancement in Spanish Conversational Models
|
13 |
+
## Description
|
14 |
+
|
15 |
+
The Conversational Spanish GPT is a refined model based on [DialoGPT-small](https://huggingface.co/microsoft/DialoGPT-small), fine-tuned with a robust set of 96,437 conversations in Spanish. Created by Josemaría Vargas Vasconcellos, this model aims to serve as a solid foundation for the development of conversational models in Spanish.
|
16 |
+
|
17 |
+
---
|
18 |
+
|
19 |
+
## Dataset
|
20 |
+
|
21 |
+
The model was trained using Spanish datasets available in [Microsoft's Bot Framework Tools repository](https://github.com/microsoft/botframework-cli). A carefully curated set of **96,437 single-turn conversations in Spanish** was meticulously selected to mitigate quality and coherence issues.
|
22 |
+
|
23 |
+
---
|
24 |
+
|
25 |
+
## Evaluation
|
26 |
+
|
27 |
+
### Limitations
|
28 |
+
|
29 |
+
After exhaustive evaluations, it was found that the model is not ideal for deployment as a contextual chatbot. However, it serves as a promising foundation for such applications. Responses tend to be brief and sometimes lack a defined focus due to conversation data diversity. Additionally, the wide range of personalities reflected in the data increases response variability.
|
30 |
+
|
31 |
+
Frequent repetitions in the data's responses have introduced certain "biases" into the model.
|
32 |
+
|
33 |
+
### Conversations examples
|
34 |
+
|
35 |
+
#### Example 1
|
36 |
+
|
37 |
+
|User | Bot |
|
38 |
+
|---------|--------|
|
39 |
+
|User | Hola |
|
40 |
+
| Bot | ¡Hola!|
|
41 |
+
|User | Cómo te llamas? |
|
42 |
+
| Bot | No tengo nombre. |
|
43 |
+
|User |Qué edad tienes? |
|
44 |
+
| Bot | Los bots estamos exentos de cumplir años. |
|
45 |
+
|User |Eres inteligente. |
|
46 |
+
| Bot | Lo sé, de vez en cuando, puedo ser brillante. |
|
47 |
+
|User |¿Crees que debería comprar un carro? |
|
48 |
+
| Bot |Confío en tu criterio. |
|
49 |
+
|
50 |
+
#### Example 2
|
51 |
+
|
52 |
+
|User | Bot |
|
53 |
+
|---------|--------|
|
54 |
+
|User | estoy triste |
|
55 |
+
| Bot | Siento escuchar eso. Te mando muchos ánimos.|
|
56 |
+
|User | Gracias |
|
57 |
+
| Bot | Perfecto. |
|
58 |
+
|User |¿Tienes sentimientos? |
|
59 |
+
| Bot |No tengo cuerpo. |
|
60 |
+
|User |A veces me siento solo. |
|
61 |
+
| Bot | Ojalá pudiera ayudarte porque creo que eres la caña. |
|
62 |
+
|User |Me caes bien. |
|
63 |
+
| Bot |¡Gracias! Me acabas de alegrar el día. |
|
64 |
+
|
65 |
+
#### Example 3
|
66 |
+
|
67 |
+
|User | Bot |
|
68 |
+
|---------|--------|
|
69 |
+
|User | ¿De qué religión eres? |
|
70 |
+
| Bot | Soy un bot.|
|
71 |
+
|User | Tienes amigos?|
|
72 |
+
| Bot | No tengo el hardware necesario para eso. |
|
73 |
+
|User |No eres humano. |
|
74 |
+
| Bot |Anotado. |
|
75 |
+
|User |¿Quieres ser mi amigo? |
|
76 |
+
| Bot | ¡Claro que sí!|
|
77 |
+
|User |Gracias.|
|
78 |
+
| Bot |Guay. |
|
79 |
+
|
80 |
+
—
|
81 |
+
|
82 |
+
## Usage
|
83 |
+
|
84 |
+
The model currently has its testing function disabled on HuggingFace due to inaccurate responses. However, users can experiment with the model using the provided code snippets:
|
85 |
+
|
86 |
+
```python
|
87 |
+
import torch
|
88 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
89 |
+
|
90 |
+
CHAT_TURNS = 5
|
91 |
+
MAX_LENGTH = 1000
|
92 |
+
|
93 |
+
model = AutoModelForCausalLM.from_pretrained('ostorc/Conversational_Spanish_GPT')
|
94 |
+
tokenizer = AutoTokenizer.from_pretrained('ostorc/Conversational_Spanish_GPT')
|
95 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
96 |
+
model.to(device)
|
97 |
+
for i in range(CHAT_TURNS):
|
98 |
+
user_input = input(f"Step - {i} >> Human ->")
|
99 |
+
with torch.no_grad():
|
100 |
+
# User turn, where "user_input" is the question (single-turn dialogue task)
|
101 |
+
user_inputs_ids = tokenizer.encode(user_input + tokenizer.eos_token, return_tensors="pt")
|
102 |
+
user_inputs_ids = user_inputs_ids.to(device)
|
103 |
+
# The chat history adds the generated tokens for the answer
|
104 |
+
chat_history = model.generate(user_inputs_ids, max_length=MAX_LENGTH, pad_token_id=tokenizer.eos_token_id)
|
105 |
+
# decode just the last generated output tokens from the model (do not include the user prompt again)
|
106 |
+
step_model_answer = tokenizer.decode(chat_history[:, user_inputs_ids.shape[-1]:][0], skip_special_tokens=True)
|
107 |
+
print(f"Step - {i} >> Bot -> {step_model_answer}")
|
108 |
+
```
|
109 |
+
---
|
110 |
+
|
111 |
+
## Suggestions:
|
112 |
+
If you come across any errors or have suggestions to enhance the model, feel free to share your thoughts in the accompanying comments. We appreciate your interest and collaboration.
|