Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,133 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
|
7 |
|
8 |
-
|
9 |
|
10 |
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
|
|
|
|
15 |
|
16 |
-
|
|
|
|
|
17 |
|
18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
19 |
|
20 |
-
|
21 |
-
-
|
22 |
-
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
-
|
|
|
|
|
|
|
29 |
|
30 |
-
|
|
|
|
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
|
|
|
|
|
|
37 |
|
38 |
-
|
|
|
|
|
|
|
39 |
|
40 |
-
|
41 |
|
42 |
-
|
43 |
|
44 |
-
|
45 |
|
46 |
-
|
47 |
|
48 |
-
|
49 |
|
50 |
-
|
51 |
|
52 |
-
|
53 |
|
54 |
-
|
55 |
|
56 |
-
|
57 |
|
58 |
-
|
59 |
|
60 |
-
|
|
|
61 |
|
62 |
-
|
|
|
|
|
63 |
|
64 |
-
|
65 |
|
66 |
-
|
67 |
|
68 |
-
|
69 |
|
70 |
-
|
71 |
|
72 |
-
|
73 |
|
74 |
-
|
75 |
|
76 |
-
|
77 |
|
78 |
-
|
79 |
|
80 |
-
|
81 |
|
82 |
-
|
83 |
|
84 |
-
|
|
|
|
|
|
|
|
|
85 |
|
86 |
-
|
87 |
|
88 |
-
|
89 |
|
90 |
-
|
91 |
|
|
|
92 |
|
93 |
-
|
94 |
|
95 |
-
|
96 |
|
97 |
-
|
98 |
|
99 |
-
|
100 |
|
101 |
-
|
102 |
|
103 |
-
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
-
|
197 |
-
## Model Card Contact
|
198 |
-
|
199 |
-
[More Information Needed]
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
base_model: Unbabel/TowerInstruct-7B-v0.2
|
4 |
+
license: apache-2.0
|
5 |
+
datasets:
|
6 |
+
- Iker/InstructTranslation-EN-ES
|
7 |
+
language:
|
8 |
+
- en
|
9 |
+
- es
|
10 |
+
pipeline_tag: text-generation
|
11 |
+
tags:
|
12 |
+
- translation
|
13 |
---
|
14 |
|
15 |
+
This is a [TowerInstruct-7B](https://huggingface.co/Unbabel/TowerInstruct-7B-v0.2) model fine-tuned for translating instructions datasets from English into Spanish. This model has GPT4 translation quality, but you can run it on your own machine for free 🎉
|
16 |
|
17 |
+
The model has been finetuned using ~1.500 prompts and answers from [teknium/OpenHermes-2.5](teknium/OpenHermes-2.5) translated to Spanish using GPT-4-0125-preview. The dataset is available here: https://huggingface.co/datasets/Iker/InstructTranslation-EN-ES/
|
18 |
|
19 |
|
20 |
|
21 |
+
# Demo
|
22 |
|
23 |
+
```python
|
24 |
+
import torch
|
25 |
+
from transformers import pipeline
|
26 |
|
27 |
+
og = pipeline("text-generation", model="Unbabel/TowerInstruct-13B-v0.1", torch_dtype=torch.bfloat16, device_map=0)
|
28 |
+
fn7 = pipeline("text-generation", model="Iker/TowerInstruct-7B-v0.2-EN2ES", torch_dtype=torch.bfloat16, device_map=1)
|
29 |
+
fn = pipeline("text-generation", model="Iker/TowerInstruct-13B-v0.1-EN2ES", torch_dtype=torch.bfloat16, device_map=2)
|
30 |
|
|
|
31 |
|
32 |
+
msg = """
|
33 |
+
Let's use Bayes' theorem again to solve this problem:\n\nLet A represent the event that the man actually has the ability to predict dice rolls with 90% accuracy, and C represent the event of predicting correctly on the first attempt.\n\nWe want to find P(A|C), the probability that the man actually has the ability given that he predicted correctly on his first attempt.\n\nBayes' theorem states that P(A|C) = P(C|A) * P(A) / P(C)\n\nFirst, let's find P(C|A): the probability of predicting correctly on the first attempt if the man actually has the ability. Since he claims 90% accuracy, this probability is 0.9.\n\nNext, let's find P(A): the probability that someone actually has the ability to predict dice rolls with 90% accuracy. We are told this is 1%, so P(A) = 0.01.\n\nNow we need to find P(C): the overall probability of predicting correctly on the first attempt. This can be calculated as the sum of probabilities for each case: P(C) = P(C|A) * P(A) + P(C|¬A) * P(¬A), where ¬A represents not having the ability and P(¬A) = 1 - P(A) = 0.99.\n\nTo find P(C|¬A), the probability of predicting correctly on the first attempt without the ability, we use the fact that there's a 1/6 chance of guessing correctly by random chance: P(C|¬A) = 1/6.\n\nSo, P(C) = (0.9)*(0.01) + (1/6)*(0.99) = 0.009 + 0.165 = 0.174.\n\nFinally, we can calculate P(A|C) using Bayes' theorem:\n\nP(A|C) = P(C|A) * P(A) / P(C) = (0.9)*(0.01) / (0.174) ≈ 0.0517.\n\nTherefore, the probability that the man actually has the ability to predict dice rolls with 90% accuracy is approximately 5.17%.
|
34 |
+
""".strip()
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
messages = [
|
37 |
+
{"role": "user",
|
38 |
+
"content": f"Translate the following text from English into Spanish.\n{msg}\nSpanish:"},
|
39 |
+
]
|
40 |
|
41 |
+
prompt = og.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
42 |
+
outputs = og(prompt, max_new_tokens=1024, do_sample=False)
|
43 |
+
print(outputs[0]["generated_text"])
|
44 |
|
45 |
+
prompt = fn7.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
46 |
+
outputs = fn7(prompt, max_new_tokens=1024, do_sample=False)
|
47 |
+
print(outputs[0]["generated_text"])
|
48 |
|
49 |
+
prompt = fn.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
50 |
+
outputs = fn(prompt, max_new_tokens=1024, do_sample=False)
|
51 |
+
print(outputs[0]["generated_text"])
|
52 |
+
```
|
53 |
|
54 |
+
### Unbabel/TowerInstruct-13B-v0.1
|
55 |
+
This model fails with very large inputs, the answer is in Russian instead of Spanish 🥴
|
56 |
+
```
|
57 |
+
Воспроизвем теорему Байеса для решения этой задачи:
|
58 |
|
59 |
+
Предположим, что A означает событие, когда человек действительно обладает способностью предсказывать результаты броска кубика с то��ностью 90%, а C означает событие правильного предсказания на первой попытке.
|
60 |
|
61 |
+
Мы хотим найти P(A|C), вероятность того, что у человека действительно есть способность, если он правильно предсказал на первой попытке.
|
62 |
|
63 |
+
Теорема Байеса утверждает, что P(A|C) = P(C|A) * P(A) / P(C)
|
64 |
|
65 |
+
Сначала определим P(C|A): вероятность правильного предсказания на первой попытке, если у человека действительно есть способность. Поскольку он утверждает, что его точность составляет 90%, эта вероятность равна 0,9.
|
66 |
|
67 |
+
Далее определим P(A): вероятность того, что у кого-то действительно есть способность предсказывать результаты броска кубика с точностью 90%. Нам сказано, что она составляет 1%, поэтому P(A) = 0,01.
|
68 |
|
69 |
+
Теперь нам нужно найти P(C): общую вероятность правильного предсказания на первой попытке. Это можно рассчитать как сумму вероятностей для каждого случая: P(C) = P(C|A) * P(A) + P(C|¬A) * P(¬A), где ¬A означает отсутствие способности, и P(¬A) = 1 - P(A) = 0,99.
|
70 |
|
71 |
+
Чтобы найти P(C|¬A), вероятность правильного предсказания на первой попытке без способности, мы используем тот факт, что существует 1/6 шанс сделать правильный выбор случайно: P(C|¬A) = 1/6.
|
72 |
|
73 |
+
Таким образом, P(C) = (0,9)*(0,01) / (0,174) ≈ 0,009 + 0,165 = 0,174.
|
74 |
|
75 |
+
Наконец, мы можем рассчитать P(A|C) с помощью теоремы Байеса:
|
76 |
|
77 |
+
P(A|C) = P(C|A) * P(A) / P(C) = (0,9)*(0,01) / (0,174) ≈ 0,0517.
|
78 |
|
79 |
+
Таким образом, вероятность того, что у человека действительно есть способность предсказывать результаты броска кубика с точностью 90%, составляет примерно 5,17%.
|
80 |
+
```
|
81 |
|
82 |
+
### Iker/TowerInstruct-7B-v0.2-EN2ES
|
83 |
+
```
|
84 |
+
Vamos a usar de nuevo el teorema de Bayes para resolver este problema:
|
85 |
|
86 |
+
A representa el evento de que el hombre realmente tenga la capacidad de predecir lanzamientos de dados con un 90% de precisión, y C representa el evento de predecir correctamente en el primer intento.
|
87 |
|
88 |
+
Queremos encontrar P(A|C), la probabilidad de que el hombre realmente tenga la capacidad dado que predecía correctamente en su primer intento.
|
89 |
|
90 |
+
El teorema de Bayes establece que P(A|C) = P(C|A) * P(A) / P(C)
|
91 |
|
92 |
+
Primero, vamos a encontrar P(C|A): la probabilidad de predecir correctamente en el primer intento si el hombre realmente tiene la capacidad. Dado que afirma un 90% de precisión, esta probabilidad es 0.9.
|
93 |
|
94 |
+
A continuación, vamos a encontrar P(A): la probabilidad de que alguien realmente tenga la capacidad de predecir lanzamientos de dados con un 90% de precisión. Nos dicen que esto es del 1%, así que P(A) = 0.01.
|
95 |
|
96 |
+
Ahora necesitamos encontrar P(C): la probabilidad total de predecir correctamente en el primer intento. Esto se puede calcular como la suma de probabilidades para cada caso: P(C) = P(C|A) * P(A) + P(C|¬A) * P(¬A), donde ¬A representa no tener la capacidad y P(¬A) = 1 - P(A) = 0.99.
|
97 |
|
98 |
+
Para encontrar P(C|¬A), la probabilidad de predecir correctamente en el primer intento sin la capacidad, usamos el hecho de que hay una probabilidad del 1/6 de adivinar correctamente por azar: P(C|¬A) = 1/6.
|
99 |
|
100 |
+
Así, P(C) = (0.9)*(0.01) + (1/6)*(0.99) = 0.009 + 0.165 = 0.174.
|
101 |
|
102 |
+
Finalmente, podemos calcular P(A|C) usando el teorema de Bayes:
|
103 |
|
104 |
+
P(A|C) = P(C|A) * P(A) / P(C) = (0.9)*(0.01) / (0.174) ≈ 0.0517.
|
105 |
|
106 |
+
Por lo tanto, la probabilidad de que el hombre realmente tenga la capacidad de predecir lanzamientos de dados con un 90% de precisión es aproximadamente del 5.17%.
|
107 |
+
```
|
108 |
+
### Iker/TowerInstruct-13B-v0.1-EN2ES
|
109 |
+
```
|
110 |
+
Vamos a usar de nuevo el teorema de Bayes para resolver este problema:
|
111 |
|
112 |
+
Sea A el evento de que el hombre realmente tenga la capacidad de predecir lanzamientos de dados con un 90% de precisión, y C el evento de predecir correctamente en el primer intento.
|
113 |
|
114 |
+
Queremos encontrar P(A|C), la probabilidad de que el hombre realmente tenga la capacidad dada que predijo correctamente en su primer intento.
|
115 |
|
116 |
+
El teorema de Bayes establece que P(A|C) = P(C|A) * P(A) / P(C)
|
117 |
|
118 |
+
Primero, vamos a encontrar P(C|A): la probabilidad de predecir correctamente en el primer intento si el hombre realmente tiene la capacidad. Dado que afirma un 90% de precisión, esta probabilidad es 0.9.
|
119 |
|
120 |
+
A continuación, vamos a encontrar P(A): la probabilidad de que alguien realmente tenga la capacidad de predecir lanzamientos de dados con un 90% de precisión. Se nos dice que este es 1%, así que P(A) = 0.01.
|
121 |
|
122 |
+
Ahora necesitamos encontrar P(C): la probabilidad general de predecir correctamente en el primer intento. Esto puede calcularse como la suma de probabilidades para cada caso: P(C) = P(C|A) * P(A) + P(C|¬A) * P(¬A), donde ¬A representa no tener la capacidad y P(¬A) = 1 - P(A) = 0.99.
|
123 |
|
124 |
+
Para encontrar P(C|¬A), la probabilidad de predecir correctamente en el primer intento sin la capacidad, utilizamos el hecho de que hay una probabilidad de 1/6 de adivinar correctamente por casualidad: P(C|¬A) = 1/6.
|
125 |
|
126 |
+
Así que, P(C) = (0.9)*(0.01) + (1/6)*(0.99) = 0.009 + 0.165 = 0.174.
|
127 |
|
128 |
+
Finalmente, podemos calcular P(A|C) usando el teorema de Bayes:
|
129 |
|
130 |
+
P(A|C) = P(C|A) * P(A) / P(C) = (0.9)*(0.01) / (0.174) ≈ 0.0517.
|
131 |
|
132 |
+
Por lo tanto, la probabilidad de que el hombre realmente tenga la capacidad de predecir lanzamientos de dados con un 90% de precisión es aproximadamente 5.17%.
|
133 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|