adalbertojunior's picture
Create README.md
4b2f9e0 verified
metadata
library_name: transformers
datasets:
  - adalbertojunior/dolphin_pt_test
language:
  - pt

Model Card for Llama-3-8B-Dolphin-Portuguese-v0.2

Model Trained on a translated version of dolphin dataset.

Usage

import transformers
import torch

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

pipeline = transformers.pipeline(
    "text-generation",
    model=model_id,
    model_kwargs={"torch_dtype": torch.bfloat16},
    device_map="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("<|eot_id|>")
]

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):])