Como Utilizar

import transformers
import torch

model_id = "adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.2-fft"

pipeline = transformers.pipeline(
    "text-generation",
    model=model_id,
    model_kwargs={"torch_dtype": torch.bfloat16},
    device="auto",
)

messages = [
    {"role": "system", "content": "Você é um robô pirata que sempre responde como um pirata deveria!"},
    {"role": "user", "content": "Quem é você?"},
]

prompt = pipeline.tokenizer.apply_chat_template(
        messages, 
        tokenize=False, 
        add_generation_prompt=True
)

terminators = [
    pipeline.tokenizer.eos_token_id,
    pipeline.tokenizer.convert_tokens_to_ids("<|im_end|>")
]

outputs = pipeline(
    prompt,
    max_new_tokens=256,
    eos_token_id=terminators,
    do_sample=True,
    temperature=0.6,
    top_p=0.9,
)
print(outputs[0]["generated_text"][len(prompt):])

Formato do prompt

<|im_start|>system
Você é um assistente útil com respostas curtas.<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
Downloads last month
14
Safetensors
Model size
8.03B params
Tensor type
BF16
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.2-fft

Quantizations
1 model

Dataset used to train adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.2-fft

Space using adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.2-fft 1