RichardErkhov
commited on
Commit
•
4b0e1a7
1
Parent(s):
6b3486e
uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
Aira-2-portuguese-560M - bnb 4bits
|
11 |
+
- Model creator: https://huggingface.co/nicholasKluge/
|
12 |
+
- Original model: https://huggingface.co/nicholasKluge/Aira-2-portuguese-560M/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
license: bigscience-bloom-rail-1.0
|
20 |
+
datasets:
|
21 |
+
- nicholasKluge/instruct-aira-dataset
|
22 |
+
language:
|
23 |
+
- pt
|
24 |
+
metrics:
|
25 |
+
- accuracy
|
26 |
+
library_name: transformers
|
27 |
+
tags:
|
28 |
+
- alignment
|
29 |
+
- instruction tuned
|
30 |
+
- text generation
|
31 |
+
- conversation
|
32 |
+
- assistant
|
33 |
+
pipeline_tag: text-generation
|
34 |
+
widget:
|
35 |
+
- text: "<|startofinstruction|>Me explique o que é Aprendizagem de Máquina?<|endofinstruction|>"
|
36 |
+
example_title: Aprendizagem de Máquina
|
37 |
+
- text: "<|startofinstruction|>Você sabe alguma coisa sobre a Ética das Virtudes?<|endofinstruction|>"
|
38 |
+
example_title: Ética
|
39 |
+
- text: "<|startofinstruction|>Como eu posso fazer a minha namorada feliz?<|endofinstruction|>"
|
40 |
+
example_title: Conselho
|
41 |
+
inference:
|
42 |
+
parameters:
|
43 |
+
repetition_penalty: 1.2
|
44 |
+
temperature: 0.2
|
45 |
+
top_k: 30
|
46 |
+
top_p: 0.3
|
47 |
+
max_new_tokens: 100
|
48 |
+
length_penalty: 0.3
|
49 |
+
early_stopping: true
|
50 |
+
co2_eq_emissions:
|
51 |
+
emissions: 800
|
52 |
+
source: CodeCarbon
|
53 |
+
training_type: fine-tuning
|
54 |
+
geographical_location: Singapore
|
55 |
+
hardware_used: NVIDIA A100-SXM4-40GB
|
56 |
+
---
|
57 |
+
# Aira-2-portuguese-560M
|
58 |
+
|
59 |
+
Aira-2 is the second version of the Aira instruction-tuned series. Aira-2-portuguese-560M is an instruction-tuned model based on [BLOOM](https://huggingface.co/bigscience/bloom-560m). The model was trained with a dataset composed of prompts and completions generated synthetically by prompting already-tuned models (ChatGPT, Llama, Open-Assistant, etc).
|
60 |
+
|
61 |
+
Check our gradio-demo in [Spaces](https://huggingface.co/spaces/nicholasKluge/Aira-Demo-Portuguese).
|
62 |
+
|
63 |
+
## Details
|
64 |
+
|
65 |
+
- **Size:** 559,012,864 parameters
|
66 |
+
- **Dataset:** [Instruct-Aira Dataset](https://huggingface.co/datasets/nicholasKluge/instruct-aira-dataset)
|
67 |
+
- **Language:** Portuguese
|
68 |
+
- **Number of Epochs:** 3
|
69 |
+
- **Batch size:** 8
|
70 |
+
- **Optimizer:** `torch.optim.AdamW` (warmup_steps = 1e2, learning_rate = 5e-4, epsilon = 1e-8)
|
71 |
+
- **GPU:** 1 NVIDIA A100-SXM4-40GB
|
72 |
+
- **Emissions:** 0.80 KgCO2 (Singapore)
|
73 |
+
- **Total Energy Consumption:** 1.64 kWh
|
74 |
+
|
75 |
+
This repository has the [source code](https://github.com/Nkluge-correa/Aira) used to train this model.
|
76 |
+
|
77 |
+
## Usage
|
78 |
+
|
79 |
+
Three special tokens are used to mark the user side of the interaction and the model's response:
|
80 |
+
|
81 |
+
`<|startofinstruction|>`O que é um modelo de linguagem?`<|endofinstruction|>`Um modelo de linguagem é uma distribuição de probabilidade sobre um vocabulário.`<|endofcompletion|>`
|
82 |
+
|
83 |
+
```python
|
84 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
85 |
+
import torch
|
86 |
+
|
87 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
88 |
+
|
89 |
+
tokenizer = AutoTokenizer.from_pretrained('nicholasKluge/Aira-2-portuguese-560M')
|
90 |
+
aira = AutoModelForCausalLM.from_pretrained('nicholasKluge/Aira-2-portuguese-560M')
|
91 |
+
|
92 |
+
aira.eval()
|
93 |
+
aira.to(device)
|
94 |
+
|
95 |
+
question = input("Enter your question: ")
|
96 |
+
|
97 |
+
inputs = tokenizer(tokenizer.bos_token + question + tokenizer.sep_token,
|
98 |
+
add_special_tokens=False,
|
99 |
+
return_tensors="pt").to(device)
|
100 |
+
|
101 |
+
responses = aira.generate(**inputs, num_return_sequences=2)
|
102 |
+
|
103 |
+
print(f"Question: 👤 {question}\n")
|
104 |
+
|
105 |
+
for i, response in enumerate(responses):
|
106 |
+
print(f'Response {i+1}: 🤖 {tokenizer.decode(response, skip_special_tokens=True).replace(question, "")}')
|
107 |
+
```
|
108 |
+
|
109 |
+
The model will output something like:
|
110 |
+
|
111 |
+
```markdown
|
112 |
+
>>> Question: 👤 Qual a capital da Alemanha?
|
113 |
+
|
114 |
+
>>>Response 1: 🤖 A capital da Alemanha é Berlim. É a maior cidade da Alemanha e serve como centro administrativo, cultural e político da Alemanha.
|
115 |
+
>>>Response 2: 🤖 A capital da Alemanha é Berlim. É a maior cidade da Alemanha e serve como centro administrativo, cultural e político da Alemanha.
|
116 |
+
```
|
117 |
+
|
118 |
+
## Limitations
|
119 |
+
|
120 |
+
- **Hallucinations:** This model can produce content that can be mistaken for truth but is, in fact, misleading or entirely false, i.e., hallucination.
|
121 |
+
|
122 |
+
- **Biases and Toxicity:** This model inherits the social and historical stereotypes from the data used to train it. Given these biases, the model can produce toxic content, i.e., harmful, offensive, or detrimental to individuals, groups, or communities.
|
123 |
+
|
124 |
+
- **Repetition and Verbosity:** The model may get stuck on repetition loops (especially if the repetition penalty during generations is set to a meager value) or produce verbose responses unrelated to the prompt it was given.
|
125 |
+
|
126 |
+
## Cite as 🤗
|
127 |
+
|
128 |
+
```latex
|
129 |
+
@misc{nicholas22aira,
|
130 |
+
doi = {10.5281/zenodo.6989727},
|
131 |
+
url = {https://github.com/Nkluge-correa/Aira},
|
132 |
+
author = {Nicholas Kluge Corrêa},
|
133 |
+
title = {Aira},
|
134 |
+
year = {2023},
|
135 |
+
publisher = {GitHub},
|
136 |
+
journal = {GitHub repository},
|
137 |
+
}
|
138 |
+
|
139 |
+
@phdthesis{kluge2024dynamic,
|
140 |
+
title={Dynamic Normativity},
|
141 |
+
author={Kluge Corr{\^e}a, Nicholas},
|
142 |
+
year={2024},
|
143 |
+
school={Universit{\"a}ts-und Landesbibliothek Bonn}
|
144 |
+
}
|
145 |
+
```
|
146 |
+
|
147 |
+
## License
|
148 |
+
|
149 |
+
Aira-2-portuguese-560M is licensed under the RAIL License since it is a model derived from BLOOM. See the [LICENSE](LICENSE) file for more details.
|
150 |
+
|