afrideva commited on
Commit
7142481
1 Parent(s): bd18422

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +295 -0
README.md ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: rhaymison/phi-3-portuguese-tom-cat-4k-instruct
3
+ datasets:
4
+ - rhaymison/superset
5
+ inference: true
6
+ language:
7
+ - pt
8
+ library_name: transformers
9
+ license: apache-2.0
10
+ model-index:
11
+ - name: phi-3-portuguese-tom-cat-4k-instruct
12
+ results:
13
+ - dataset:
14
+ args:
15
+ num_few_shot: 3
16
+ name: ENEM Challenge (No Images)
17
+ split: train
18
+ type: eduagarcia/enem_challenge
19
+ metrics:
20
+ - name: accuracy
21
+ type: acc
22
+ value: 61.58
23
+ source:
24
+ name: Open Portuguese LLM Leaderboard
25
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/phi-3-portuguese-tom-cat-4k-instruct
26
+ task:
27
+ name: Text Generation
28
+ type: text-generation
29
+ - dataset:
30
+ args:
31
+ num_few_shot: 3
32
+ name: BLUEX (No Images)
33
+ split: train
34
+ type: eduagarcia-temp/BLUEX_without_images
35
+ metrics:
36
+ - name: accuracy
37
+ type: acc
38
+ value: 50.63
39
+ source:
40
+ name: Open Portuguese LLM Leaderboard
41
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/phi-3-portuguese-tom-cat-4k-instruct
42
+ task:
43
+ name: Text Generation
44
+ type: text-generation
45
+ - dataset:
46
+ args:
47
+ num_few_shot: 3
48
+ name: OAB Exams
49
+ split: train
50
+ type: eduagarcia/oab_exams
51
+ metrics:
52
+ - name: accuracy
53
+ type: acc
54
+ value: 43.69
55
+ source:
56
+ name: Open Portuguese LLM Leaderboard
57
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/phi-3-portuguese-tom-cat-4k-instruct
58
+ task:
59
+ name: Text Generation
60
+ type: text-generation
61
+ - dataset:
62
+ args:
63
+ num_few_shot: 15
64
+ name: Assin2 RTE
65
+ split: test
66
+ type: assin2
67
+ metrics:
68
+ - name: f1-macro
69
+ type: f1_macro
70
+ value: 91.54
71
+ source:
72
+ name: Open Portuguese LLM Leaderboard
73
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/phi-3-portuguese-tom-cat-4k-instruct
74
+ task:
75
+ name: Text Generation
76
+ type: text-generation
77
+ - dataset:
78
+ args:
79
+ num_few_shot: 15
80
+ name: Assin2 STS
81
+ split: test
82
+ type: eduagarcia/portuguese_benchmark
83
+ metrics:
84
+ - name: pearson
85
+ type: pearson
86
+ value: 75.27
87
+ source:
88
+ name: Open Portuguese LLM Leaderboard
89
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/phi-3-portuguese-tom-cat-4k-instruct
90
+ task:
91
+ name: Text Generation
92
+ type: text-generation
93
+ - dataset:
94
+ args:
95
+ num_few_shot: 15
96
+ name: FaQuAD NLI
97
+ split: test
98
+ type: ruanchaves/faquad-nli
99
+ metrics:
100
+ - name: f1-macro
101
+ type: f1_macro
102
+ value: 47.46
103
+ source:
104
+ name: Open Portuguese LLM Leaderboard
105
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/phi-3-portuguese-tom-cat-4k-instruct
106
+ task:
107
+ name: Text Generation
108
+ type: text-generation
109
+ - dataset:
110
+ args:
111
+ num_few_shot: 25
112
+ name: HateBR Binary
113
+ split: test
114
+ type: ruanchaves/hatebr
115
+ metrics:
116
+ - name: f1-macro
117
+ type: f1_macro
118
+ value: 83.01
119
+ source:
120
+ name: Open Portuguese LLM Leaderboard
121
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/phi-3-portuguese-tom-cat-4k-instruct
122
+ task:
123
+ name: Text Generation
124
+ type: text-generation
125
+ - dataset:
126
+ args:
127
+ num_few_shot: 25
128
+ name: PT Hate Speech Binary
129
+ split: test
130
+ type: hate_speech_portuguese
131
+ metrics:
132
+ - name: f1-macro
133
+ type: f1_macro
134
+ value: 70.19
135
+ source:
136
+ name: Open Portuguese LLM Leaderboard
137
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/phi-3-portuguese-tom-cat-4k-instruct
138
+ task:
139
+ name: Text Generation
140
+ type: text-generation
141
+ - dataset:
142
+ args:
143
+ num_few_shot: 25
144
+ name: tweetSentBR
145
+ split: test
146
+ type: eduagarcia/tweetsentbr_fewshot
147
+ metrics:
148
+ - name: f1-macro
149
+ type: f1_macro
150
+ value: 57.78
151
+ source:
152
+ name: Open Portuguese LLM Leaderboard
153
+ url: https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard?query=rhaymison/phi-3-portuguese-tom-cat-4k-instruct
154
+ task:
155
+ name: Text Generation
156
+ type: text-generation
157
+ model_creator: rhaymison
158
+ model_name: phi-3-portuguese-tom-cat-4k-instruct
159
+ pipeline_tag: text-generation
160
+ quantized_by: afrideva
161
+ tags:
162
+ - portugues
163
+ - portuguese
164
+ - QA
165
+ - instruct
166
+ - phi
167
+ - gguf
168
+ - ggml
169
+ - quantized
170
+ ---
171
+
172
+ # phi-3-portuguese-tom-cat-4k-instruct-GGUF
173
+
174
+ Quantized GGUF model files for [phi-3-portuguese-tom-cat-4k-instruct](https://huggingface.co/rhaymison/phi-3-portuguese-tom-cat-4k-instruct) from [rhaymison](https://huggingface.co/rhaymison)
175
+
176
+ ## Original Model Card:
177
+
178
+ # Phi-3-portuguese-tom-cat-4k-instruct
179
+
180
+ <p align="center">
181
+ <img src="https://raw.githubusercontent.com/rhaymisonbetini/huggphotos/main/tom-cat.webp" width="50%" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
182
+ </p>
183
+
184
+
185
+ This model was trained with a superset of 300,000 instructions in Portuguese.
186
+ The model comes to help fill the gap in models in Portuguese. Tuned from the microsoft/Phi-3-mini-4k.
187
+
188
+ # How to use
189
+
190
+ ### FULL MODEL : A100
191
+ ### HALF MODEL: L4
192
+ ### 8bit or 4bit : T4 or V100
193
+
194
+ You can use the model in its normal form up to 4-bit quantization. Below we will use both approaches.
195
+ Remember that verbs are important in your prompt. Tell your model how to act or behave so that you can guide them along the path of their response.
196
+ Important points like these help models (even smaller models like 4b) to perform much better.
197
+
198
+ ```python
199
+ !pip install -q -U transformers
200
+ !pip install -q -U accelerate
201
+ !pip install -q -U bitsandbytes
202
+
203
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
204
+ model = AutoModelForCausalLM.from_pretrained("rhaymison/phi-3-portuguese-tom-cat-4k-instruct", device_map= {"": 0})
205
+ tokenizer = AutoTokenizer.from_pretrained("rhaymison/phi-3-portuguese-tom-cat-4k-instruct")
206
+ model.eval()
207
+
208
+ ```
209
+
210
+ You can use with Pipeline.
211
+ ```python
212
+
213
+ from transformers import pipeline
214
+ pipe = pipeline("text-generation",
215
+ model=model,
216
+ tokenizer=tokenizer,
217
+ do_sample=True,
218
+ max_new_tokens=512,
219
+ num_beams=2,
220
+ temperature=0.3,
221
+ top_k=50,
222
+ top_p=0.95,
223
+ early_stopping=True,
224
+ pad_token_id=tokenizer.eos_token_id,
225
+ )
226
+
227
+
228
+ def format_template(question:str):
229
+ system_prompt = "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."
230
+ return f"""<s><|system|>
231
+ { system_prompt }
232
+ <|user|>
233
+ { question }
234
+ <|assistant|>
235
+ """
236
+
237
+ question = format_template("E possivel ir de Carro dos Estados unidos ate o japão")
238
+ pipe(question)
239
+ ```
240
+
241
+ If you are having a memory problem such as "CUDA Out of memory", you should use 4-bit or 8-bit quantization.
242
+ For the complete model in colab you will need the A100.
243
+ If you want to use 4bits or 8bits, T4 or L4 will already solve the problem.
244
+
245
+ # 4bits example
246
+
247
+ ```python
248
+ from transformers import BitsAndBytesConfig
249
+ import torch
250
+ nb_4bit_config = BitsAndBytesConfig(
251
+ load_in_4bit=True,
252
+ bnb_4bit_quant_type="nf4",
253
+ bnb_4bit_compute_dtype=torch.bfloat16,
254
+ bnb_4bit_use_double_quant=True
255
+ )
256
+
257
+ model = AutoModelForCausalLM.from_pretrained(
258
+ base_model,
259
+ quantization_config=bnb_config,
260
+ device_map={"": 0}
261
+ )
262
+
263
+ ```
264
+
265
+ # Open Portuguese LLM Leaderboard Evaluation Results
266
+
267
+ Detailed results can be found [here](https://huggingface.co/datasets/eduagarcia-temp/llm_pt_leaderboard_raw_results/tree/main/rhaymison/phi-3-portuguese-tom-cat-4k-instruct) and on the [🚀 Open Portuguese LLM Leaderboard](https://huggingface.co/spaces/eduagarcia/open_pt_llm_leaderboard)
268
+
269
+ | Metric | Value |
270
+ |--------------------------|---------|
271
+ |Average |**64.57**|
272
+ |ENEM Challenge (No Images)| 61.58|
273
+ |BLUEX (No Images) | 50.63|
274
+ |OAB Exams | 43.69|
275
+ |Assin2 RTE | 91.54|
276
+ |Assin2 STS | 75.27|
277
+ |FaQuAD NLI | 47.46|
278
+ |HateBR Binary | 83.01|
279
+ |PT Hate Speech Binary | 70.19|
280
+ |tweetSentBR | 57.78|
281
+
282
+
283
+ ### Comments
284
+
285
+ Any idea, help or report will always be welcome.
286
+
287
+ email: rhaymisoncristian@gmail.com
288
+
289
+ <div style="display:flex; flex-direction:row; justify-content:left">
290
+ <a href="https://www.linkedin.com/in/rhaymison-cristian-betini-2b3016175/" target="_blank">
291
+ <img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white">
292
+ </a>
293
+ <a href="https://github.com/rhaymisonbetini" target="_blank">
294
+ <img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white">
295
+ </a>