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