Views
No views yet
apply_chat_template to show you how to load the tokenizer and model and how to generate contents.1from transformers import AutoModelForCausalLM, AutoTokenizer
2device = "cuda" # the device to load the model onto
3
4model = AutoModelForCausalLM.from_pretrained(
5 "OliveiraJLT/Sagui-7B-Instruct-v0.1",
6 torch_dtype="auto",
7 device_map="auto"
8)
9tokenizer = AutoTokenizer.from_pretrained("OliveiraJLT/Sagui-7B-Instruct-v0.1")
10
11prompt = "Por favor, conte-me sobre as habilidades de comunicação dos saguis."
12messages = [
13 {"role": "system", "content": "Você é Sagui-7B-Instruct-v0.1, um modelo de linguagem. Sua missão é ajudar os usuários em diversas tarefas, fornecendo informações precisas, relevantes e úteis de maneira educada, informativa, envolvente e profissional."},
14 {"role": "user", "content": prompt}
15]
16text = tokenizer.apply_chat_template(
17 messages,
18 tokenize=False,
19 add_generation_prompt=True
20)
21model_inputs = tokenizer([text], return_tensors="pt").to(device)
22
23generated_ids = model.generate(
24 model_inputs.input_ids,
25 max_length=2048
26)
27generated_ids = [
28 output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
29]
30
31response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]1@software{OliveiraJLT2024Sagui7BInstruct01
2 title = {Sagui-7B-Instruct-v0.1},
3 author = {Oliveira, J. L. T.},
4 year = {2024},
5 publisher = {HuggingFace},
6 journal = {HuggingFace repository},
7 howpublished = {\url{https://huggingface.co/OliveiraJLT/Sagui-7B-Instruct-v0.1}
8}| Metric | Value |
|---|---|
| Average | 39.87 |
| ENEM Challenge (No Images) | 51.36 |
| BLUEX (No Images) | 43.67 |
| OAB Exams | 36.22 |
| Assin2 RTE | 71.16 |
| Assin2 STS | 3.16 |
| FaQuAD NLI | 58.05 |
| HateBR Binary | 46.46 |
| PT Hate Speech Binary | 30.38 |
| tweetSentBR | 18.34 |
| Metric | Value |
|---|---|
| Avg. | 8.39 |
| IFEval (0-Shot) | 28.92 |
| BBH (3-Shot) | 5.04 |
| MATH Lvl 5 (4-Shot) | 0.38 |
| GPQA (0-shot) | 0.00 |
| MuSR (0-shot) | 10.61 |
| MMLU-PRO (5-shot) | 5.39 |