File size: 4,473 Bytes
2b9fcd8
94b29aa
 
 
 
 
 
 
 
 
 
 
9d8c568
 
 
 
 
 
 
 
 
 
93c20b1
1fee741
 
 
 
 
 
 
 
 
2b9fcd8
 
94b29aa
 
2b9fcd8
94b29aa
37d7a6b
94b29aa
2b9fcd8
ca71465
2b9fcd8
94b29aa
 
 
 
2b9fcd8
94b29aa
2b9fcd8
329dd6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42cef61
bf41bfe
 
42cef61
 
 
 
 
 
 
2b9fcd8
42cef61
2b9fcd8
42cef61
 
 
 
 
 
2b9fcd8
42cef61
2b9fcd8
42cef61
 
 
 
 
 
 
 
 
 
2b9fcd8
94b29aa
2b9fcd8
94b29aa
2b9fcd8
94b29aa
2b9fcd8
94b29aa
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
language:
- pt
license: apache-2.0
tags:
- text-generation-inference
- portuguese
- version:0.1
datasets:
- rhaymison/questions_answers_geo_nord
base_model: google/gemma-2b-it
pipeline_tag: text-generation
inference: false
  # parameters:
  #   do_sample: true
  #   repetition_penalty: 1.0
  #   top_k: 50 
  #   top_p: 0.95
  #   temperature: 0.1
  #   num_return_sequences: 1
  #   early_stopping: true
  #   num_beams: 2
widget:
- text: Me conte sobre o Cuscuz nordestino.
  example_title: Cuscuz
- text: Me fale sobre as praias da Bahia?
  example_title: Praias da Bahia
- text: Qual a importancia da Paraiba ?
  example_title: Paraiba
model-index:
- name: opus-en-to-pt-translate
  results: []
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

<p align="center">
  <img src="https://raw.githubusercontent.com/rhaymisonbetini/huggphotos/main/7.webp" alt="" width="100%" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
</p>

updated: 14-03-2024

## Model description
The Cuscuz-com-gemma 2b is a model derived from a fine tuning of the google/gemma-2b-it. This model was tuned to be specialized in the Northeast region of Brazil. 
The model was specialized in a dataset that covered historical, geographical, economic, cultural and culinary issues in the northeast region.
To make better use of the Cuscuz, the ideal is to use the model without quantization. This model is a small version of Cuscuz-7b whit another arquiteture

## How to Use


```python
from transformers import AutoTokenizer, pipeline
import torch

model = "rhaymison/cuscuz-com-gemma-2b"

tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = pipeline(
    "text-generation",
    model=model,
    model_kwargs={"torch_dtype": torch.bfloat16},
    device="cuda",
)

messages = [
    {"role": "user", "content": "Me conte sobre o estado de Sergipe."},
]
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipeline(
    prompt,
    max_new_tokens=256,
    do_sample=True,
    temperature=0.7,
    top_k=50,
    top_p=0.95
)
print(outputs[0]["generated_text"][len(prompt):].replace("model",""))

#Sergipe é o menor estado do Nordeste brasileiro em extensão territorial. 
#O estado de Sergipe é conhecido por suas praias, sua culinária à base de frutos do mar e sua importância histórica na produção de açúcar. 
#Sergipe teve papel fundamental na produção de açúcar no Brasil colonial, sendo uma das regiões onde se concentraram os engenhos de açúcar.
```


```python
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer2 = AutoTokenizer.from_pretrained("cuscuz-com-gemma-2b")
model2 = AutoModelForCausalLM.from_pretrained("cuscuz-com-gemma-2b", device_map={"":0})
tokenizer2.pad_token = tokenizer2.eos_token
tokenizer2.add_eos_token = True
tokenizer2.add_bos_token, tokenizer2.add_eos_token
tokenizer2.padding_side = "right"
```

```python

text = f"""
Você é um assistente especialista em história do Nordeste Brasileiro.
Você sempre responde de forma clara e educada e sempre com informações
verdadeiras. Responda com detalhes e riquesas de informação
<start_of_turn>Me conte sobre o Folclore Nordestino?<end_of_turn>
<start_of_turn>model"""

device = "cuda:0"

inputs = tokenizer2(text, return_tensors="pt").to(device)

outputs = model2.generate(**inputs, max_new_tokens=100, do_sample=False)

output = tokenizer2.decode(outputs[0], skip_special_tokens=True, skip_prompt=True)
print(output.replace("model"," "))

#O Folclore Nordestino é uma parte importante da nossa cultura, com manifestações como o bumba meu boi, o reisado, o maracatu e o repente.
#Essa história é rica em lendas, contarorias e tradições que são passadas de geração em geração.  
```

### Comments

Any idea, help or report will always be welcome.

email: rhaymisoncristian@gmail.com

 <div style="display:flex; flex-direction:row; justify-content:left">
    <a href="https://www.linkedin.com/in/heleno-betini-2b3016175/" target="_blank">
    <img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white">
  </a>
  <a href="https://github.com/rhaymisonbetini" target="_blank">
    <img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white">
  </a>
 </div>