Run this model with HF Jobs

Run rhaymison/cuscuz-com-gemma-2b on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/rhaymison/cuscuz-com-gemma-2b. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/rhaymison/cuscuz-com-gemma-2b on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/rhaymison/cuscuz-com-gemma-2b. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/rhaymison/cuscuz-com-gemma-2b. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

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

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.
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"

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

Downloads last month
21
Safetensors
Model size
3B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for rhaymison/cuscuz-com-gemma-2b

Finetuned
(125)
this model
Quantizations
1 model

Dataset used to train rhaymison/cuscuz-com-gemma-2b