aashish1904 commited on
Commit
65eac86
·
verified ·
1 Parent(s): 1d571a0

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +329 -0
README.md ADDED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+
4
+ language:
5
+ - pt
6
+ license: apache-2.0
7
+ library_name: transformers
8
+ tags:
9
+ - portuguese
10
+ - brasil
11
+ - gemma
12
+ - portugues
13
+ - instrucao
14
+ datasets:
15
+ - rhaymison/superset
16
+ pipeline_tag: text-generation
17
+ widget:
18
+ - text: Me explique como funciona um computador.
19
+ example_title: Computador.
20
+ - text: Me conte sobre a ida do homem a Lua.
21
+ example_title: Homem na Lua.
22
+ - text: Fale sobre uma curiosidade sobre a história do mundo
23
+ example_title: História.
24
+ - text: Escreva um poema bem interessante sobre o Sol e as flores.
25
+ example_title: Escreva um poema.
26
+ model-index:
27
+ - name: gemma-portuguese-luana-2b
28
+ results:
29
+ - task:
30
+ type: text-generation
31
+ name: Text Generation
32
+ dataset:
33
+ name: ENEM Challenge (No Images)
34
+ type: eduagarcia/enem_challenge
35
+ split: train
36
+ args:
37
+ num_few_shot: 3
38
+ metrics:
39
+ - type: acc
40
+ value: 24.42
41
+ name: accuracy
42
+ source:
43
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/gemma-portuguese-luana-2b
44
+ name: Open Portuguese LLM Leaderboard
45
+ - task:
46
+ type: text-generation
47
+ name: Text Generation
48
+ dataset:
49
+ name: BLUEX (No Images)
50
+ type: eduagarcia-temp/BLUEX_without_images
51
+ split: train
52
+ args:
53
+ num_few_shot: 3
54
+ metrics:
55
+ - type: acc
56
+ value: 24.34
57
+ name: accuracy
58
+ source:
59
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/gemma-portuguese-luana-2b
60
+ name: Open Portuguese LLM Leaderboard
61
+ - task:
62
+ type: text-generation
63
+ name: Text Generation
64
+ dataset:
65
+ name: OAB Exams
66
+ type: eduagarcia/oab_exams
67
+ split: train
68
+ args:
69
+ num_few_shot: 3
70
+ metrics:
71
+ - type: acc
72
+ value: 27.11
73
+ name: accuracy
74
+ source:
75
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/gemma-portuguese-luana-2b
76
+ name: Open Portuguese LLM Leaderboard
77
+ - task:
78
+ type: text-generation
79
+ name: Text Generation
80
+ dataset:
81
+ name: Assin2 RTE
82
+ type: assin2
83
+ split: test
84
+ args:
85
+ num_few_shot: 15
86
+ metrics:
87
+ - type: f1_macro
88
+ value: 70.86
89
+ name: f1-macro
90
+ source:
91
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/gemma-portuguese-luana-2b
92
+ name: Open Portuguese LLM Leaderboard
93
+ - task:
94
+ type: text-generation
95
+ name: Text Generation
96
+ dataset:
97
+ name: Assin2 STS
98
+ type: eduagarcia/portuguese_benchmark
99
+ split: test
100
+ args:
101
+ num_few_shot: 15
102
+ metrics:
103
+ - type: pearson
104
+ value: 1.51
105
+ name: pearson
106
+ source:
107
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/gemma-portuguese-luana-2b
108
+ name: Open Portuguese LLM Leaderboard
109
+ - task:
110
+ type: text-generation
111
+ name: Text Generation
112
+ dataset:
113
+ name: FaQuAD NLI
114
+ type: ruanchaves/faquad-nli
115
+ split: test
116
+ args:
117
+ num_few_shot: 15
118
+ metrics:
119
+ - type: f1_macro
120
+ value: 43.97
121
+ name: f1-macro
122
+ source:
123
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/gemma-portuguese-luana-2b
124
+ name: Open Portuguese LLM Leaderboard
125
+ - task:
126
+ type: text-generation
127
+ name: Text Generation
128
+ dataset:
129
+ name: HateBR Binary
130
+ type: ruanchaves/hatebr
131
+ split: test
132
+ args:
133
+ num_few_shot: 25
134
+ metrics:
135
+ - type: f1_macro
136
+ value: 40.05
137
+ name: f1-macro
138
+ source:
139
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/gemma-portuguese-luana-2b
140
+ name: Open Portuguese LLM Leaderboard
141
+ - task:
142
+ type: text-generation
143
+ name: Text Generation
144
+ dataset:
145
+ name: PT Hate Speech Binary
146
+ type: hate_speech_portuguese
147
+ split: test
148
+ args:
149
+ num_few_shot: 25
150
+ metrics:
151
+ - type: f1_macro
152
+ value: 51.83
153
+ name: f1-macro
154
+ source:
155
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/gemma-portuguese-luana-2b
156
+ name: Open Portuguese LLM Leaderboard
157
+ - task:
158
+ type: text-generation
159
+ name: Text Generation
160
+ dataset:
161
+ name: tweetSentBR
162
+ type: eduagarcia/tweetsentbr_fewshot
163
+ split: test
164
+ args:
165
+ num_few_shot: 25
166
+ metrics:
167
+ - type: f1_macro
168
+ value: 30.42
169
+ name: f1-macro
170
+ source:
171
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/gemma-portuguese-luana-2b
172
+ name: Open Portuguese LLM Leaderboard
173
+
174
+ ---
175
+
176
+ [![QuantFactory Banner](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)](https://hf.co/QuantFactory)
177
+
178
+
179
+ # QuantFactory/gemma-portuguese-luana-2b-GGUF
180
+ This is quantized version of [rhaymison/gemma-portuguese-luana-2b](https://huggingface.co/rhaymison/gemma-portuguese-luana-2b) created using llama.cpp
181
+
182
+ # Original Model Card
183
+
184
+
185
+ # gemma-portuguese-2b-luana
186
+
187
+
188
+ <p align="center">
189
+ <img src="https://raw.githubusercontent.com/rhaymisonbetini/huggphotos/main/luana-2b.webp" width="50%" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
190
+ </p>
191
+
192
+
193
+
194
+ ## Model description
195
+
196
+ updated: 2024-04-10 20:06
197
+
198
+ The gemma-portuguese-2b model is a portuguese model trained with the superset dataset with 250,000 instructions.
199
+ The model is mainly focused on text generation and instruction.
200
+ The model was not trained on math and code tasks.
201
+ The model is generalist with focus on understand portuguese inferences.
202
+ With this fine tuning for portuguese, you can adjust the model for a specific field.
203
+
204
+ ## How to Use
205
+
206
+
207
+ ```python
208
+ from transformers import AutoTokenizer, pipeline
209
+ import torch
210
+
211
+ model = "rhaymison/gemma-portuguese-luana-2b"
212
+
213
+ tokenizer = AutoTokenizer.from_pretrained(model)
214
+ pipeline = pipeline(
215
+ "text-generation",
216
+ model=model,
217
+ model_kwargs={"torch_dtype": torch.bfloat16},
218
+ device="cuda",
219
+ )
220
+
221
+ messages = [
222
+ {
223
+ "role": "system",
224
+ "content": "Abaixo está uma instrução que descreve uma tarefa, juntamente com uma entrada que fornece mais contexto. Escreva uma resposta que complete adequadamente o pedido."
225
+ },
226
+ {"role": "user", "content": "Me conte sobre a ida do homem a Lua."},
227
+ ]
228
+ prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
229
+ outputs = pipeline(
230
+ prompt,
231
+ max_new_tokens=256,
232
+ do_sample=True,
233
+ temperature=0.2,
234
+ top_k=50,
235
+ top_p=0.95
236
+ )
237
+ print(outputs[0]["generated_text"][len(prompt):].replace("model",""))
238
+
239
+ #A viagem à Lua foi um esforço monumental realizado pela Agência Espacial dos EUA entre 1969 e 1972.
240
+ #Foi um marco significativo na exploração espacial e na ciência humana.
241
+ #Aqui está uma visão geral de sua jornada: 1. O primeiro voo espacial humano foi o de Yuri Gagarin, que voou a Terra em 12 de abril de 1961.
242
+ ```
243
+
244
+
245
+ ```python
246
+ from transformers import AutoTokenizer, AutoModelForCausalLM
247
+
248
+ tokenizer2 = AutoTokenizer.from_pretrained("rhaymison/gemma-portuguese-luana-2b")
249
+ model2 = AutoModelForCausalLM.from_pretrained("rhaymison/gemma-portuguese-luana-2b", device_map={"":0})
250
+ tokenizer2.pad_token = tokenizer2.eos_token
251
+ tokenizer2.add_eos_token = True
252
+ tokenizer2.add_bos_token, tokenizer2.add_eos_token
253
+ tokenizer2.padding_side = "right"
254
+ ```
255
+
256
+ ```python
257
+ text = f"""<start_of_turn>user
258
+ Abaixo está uma instrução que descreve uma tarefa, juntamente com uma entrada que fornece mais contexto. Escreva uma resposta que complete adequadamente o pedido.
259
+ ###instrução:Me conte sobre a ida do homem a Lua.<end_of_turn>
260
+ <start_of_turn>model """
261
+
262
+ device = "cuda:0"
263
+
264
+ inputs = tokenizer2(text, return_tensors="pt").to(device)
265
+
266
+ outputs = model2.generate(**inputs, max_new_tokens=256, do_sample=False)
267
+
268
+ output = tokenizer2.decode(outputs[0], skip_special_tokens=True, skip_prompt=True)
269
+ print(output.replace("model"," "))
270
+
271
+ #A viagem à Lua foi um esforço monumental realizado pela Agência Espacial dos EUA entre 1969 e 1972.
272
+ #Foi um marco significativo na exploração espacial e na ciência humana.
273
+ #Aqui está uma visão geral de sua jornada: 1. O primeiro voo espacial humano foi o de Yuri Gagarin, que voou a Terra em 12 de abril de 1961.
274
+ ```
275
+
276
+ ```python
277
+ text = f"""<start_of_turn>user
278
+ Abaixo está uma instrução que descreve uma tarefa, juntamente com uma entrada que fornece mais contexto. Escreva uma resposta que complete adequadamente o pedido.
279
+ ###instrução:Me explique como funciona um computador.<end_of_turn>
280
+ <start_of_turn>model """
281
+
282
+ device = "cuda:0"
283
+
284
+ inputs = tokenizer2(text, return_tensors="pt").to(device)
285
+
286
+ outputs = model2.generate(**inputs, max_new_tokens=256, do_sample=False)
287
+
288
+ output = tokenizer2.decode(outputs[0], skip_special_tokens=True, skip_prompt=True)
289
+ print(output.replace("model"," "))
290
+
291
+ #Um computador é um dispositivo eletrônico que pode executar tarefas que um humano pode fazer.
292
+ #Ele usa um conjunto de circuitos elétricos, componentes eletrônicos e software para processar informações e executar tarefas.
293
+ #Os componentes de um computador incluem um processador, memória, unidade de armazenamento, unidade de processamento gráfica,
294
+ #unidade de controle, unidade de entrada e saída,e dispositivos de entrada e saída.
295
+ #O processador é o coração do computador e executa instruções de software.A memória é onde o computador armazena
296
+ ```
297
+
298
+
299
+ # Open Portuguese LLM Leaderboard Evaluation Results
300
+ Detailed results can be found [here](https://huggingface.co/datasets/eduagarcia-temp/llm_pt_leaderboard_raw_results/tree/main/rhaymison/gemma-portuguese-luana-2b) and on the [🚀 Open Portuguese LLM Leaderboard](https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard)
301
+
302
+ | Metric | Value |
303
+ |--------------------------|---------|
304
+ |Average |**34.94**|
305
+ |ENEM Challenge (No Images)| 24.42|
306
+ |BLUEX (No Images) | 24.34|
307
+ |OAB Exams | 27.11|
308
+ |Assin2 RTE | 70.86|
309
+ |Assin2 STS | 1.51|
310
+ |FaQuAD NLI | 43.97|
311
+ |HateBR Binary | 40.05|
312
+ |PT Hate Speech Binary | 51.83|
313
+ |tweetSentBR | 30.42|
314
+
315
+
316
+ ### Comments
317
+
318
+ Any idea, help or report will always be welcome.
319
+
320
321
+
322
+ <div style="display:flex; flex-direction:row; justify-content:left">
323
+ <a href="https://www.linkedin.com/in/rhaymison-cristian-betini-2b3016175/" target="_blank">
324
+ <img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white">
325
+ </a>
326
+ <a href="https://github.com/rhaymisonbetini" target="_blank">
327
+ <img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white">
328
+ </a>
329
+ </div>