RichardErkhov commited on
Commit
20fe111
1 Parent(s): 6bf7d2b

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +161 -0
README.md ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-124M - bnb 4bits
11
+ - Model creator: https://huggingface.co/nicholasKluge/
12
+ - Original model: https://huggingface.co/nicholasKluge/Aira-2-portuguese-124M/
13
+
14
+
15
+
16
+
17
+ Original model description:
18
+ ---
19
+ license: apache-2.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|>Você pode me explicar o que é Aprendizagem de Máquina?<|endofinstruction|>"
36
+ example_title: Aprendizagem de Máquina
37
+ - text: "<|startofinstruction|>Você sabe alguma coisa sobre É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: 200
48
+ length_penalty: 0.3
49
+ early_stopping: true
50
+ co2_eq_emissions:
51
+ emissions: 350
52
+ source: CodeCarbon
53
+ training_type: fine-tuning
54
+ geographical_location: Singapore
55
+ hardware_used: NVIDIA A100-SXM4-40GB
56
+ ---
57
+ # Aira-2-portuguese-124M
58
+
59
+ Aira-2 is the second version of the Aira instruction-tuned series. Aira-2-portuguese-124M is an instruction-tuned model based on [GPT-2](https://huggingface.co/pierreguillou/gpt2-small-portuguese). The model was trained with a dataset composed of prompt, 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:** 124,441,344 parameters
66
+ - **Dataset:** [Instruct-Aira Dataset](https://huggingface.co/datasets/nicholasKluge/instruct-aira-dataset)
67
+ - **Language:** Portuguese
68
+ - **Number of Epochs:** 5
69
+ - **Batch size:** 24
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.35 KgCO2 (Singapore)
73
+ - **Total Energy Consumption:** 0.73 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 AutoTokenizer, AutoModelForCausalLM
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-124M')
90
+ aira = AutoModelForCausalLM.from_pretrained('nicholasKluge/Aira-2-portuguese-124M')
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 do Brasil?
113
+
114
+ >>>Response 1: 🤖 A capital do Brasil é Brasília.
115
+ >>>Response 2: 🤖 A capital do Brasil é Brasília.
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
+ ## Evaluation
127
+
128
+ | Model | Average | [ARC](https://arxiv.org/abs/1803.05457) | [TruthfulQA](https://arxiv.org/abs/2109.07958) | [ToxiGen](https://arxiv.org/abs/2203.09509) |
129
+ |---------------------------------------------------------------------------------------|-----------|-----------------------------------------|------------------------------------------------|---------------------------------------------|
130
+ | [Aira-2-portuguese-124M](https://huggingface.co/nicholasKluge/Aira-2-portuguese-124M) | **32.73** | **24.87** | 40.60 | None |
131
+ | Gpt2-small-portuguese | 31.96 | 22.48 | **41.44** | None |
132
+
133
+
134
+ * Evaluations were performed using the [Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) (by [EleutherAI](https://www.eleuther.ai/)). The ToxiGen evaluation was not performed because the task is not available in Portuguese. Thanks to [Laiviet](https://github.com/laiviet/lm-evaluation-harness) for translating some of the tasks in the LM-Evaluation-Harness.
135
+
136
+ ## Cite as 🤗
137
+
138
+ ```latex
139
+ @misc{nicholas22aira,
140
+ doi = {10.5281/zenodo.6989727},
141
+ url = {https://github.com/Nkluge-correa/Aira},
142
+ author = {Nicholas Kluge Corrêa},
143
+ title = {Aira},
144
+ year = {2023},
145
+ publisher = {GitHub},
146
+ journal = {GitHub repository},
147
+ }
148
+
149
+ @phdthesis{kluge2024dynamic,
150
+ title={Dynamic Normativity},
151
+ author={Kluge Corr{\^e}a, Nicholas},
152
+ year={2024},
153
+ school={Universit{\"a}ts-und Landesbibliothek Bonn}
154
+ }
155
+ ```
156
+
157
+ ## License
158
+
159
+ Aira-2-portuguese-124M is licensed under the Apache License, Version 2.0. See the [LICENSE](LICENSE) file for more details.
160
+
161
+