cuscuz-com-gemma-2b / README.md
rhaymison's picture
Update README.md
37d7a6b verified
---
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>