Views
No views yet

<|im_start|>system
Sei un assistente utile.<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant| Tasks | Version | Filter | n-shot | Metric | Value | Stderr | |
|---|---|---|---|---|---|---|---|
| hellaswag_it | 1 | none | 0 | acc | 0.5270 | ± | 0.0052 |
| none | 0 | acc_norm | 0.7037 | ± | 0.0048 | ||
| arc_it | 1 | none | 0 | acc | 0.1771 | ± | 0.0112 |
| none | 0 | acc_norm | 0.5218 | ± | 0.0146 | ||
| m_mmlu_it | 0 | none | 5 | acc | 0.5623 | ± | 0.0043 |
1from transformers import (
2 AutoTokenizer,
3 AutoModelForCausalLM,
4 GenerationConfig,
5 TextStreamer
6)
7import torch
8
9tokenizer = AutoTokenizer.from_pretrained("mii-llm/maestrale-chat-v0.4-beta")
10model = AutoModelForCausalLM.from_pretrained("mii-llm/maestrale-chat-v0.4-beta", load_in_8bit=True, device_map="auto")
11
12gen = GenerationConfig(
13 do_sample=True,
14 temperature=0.7,
15 repetition_penalty=1.2,
16 top_k=50,
17 top_p=0.95,
18 max_new_tokens=500,
19 pad_token_id=tokenizer.eos_token_id,
20 eos_token_id=tokenizer.convert_tokens_to_ids("<|im_end|>")
21)
22
23streamer = TextStreamer(tokenizer, skip_prompt=True)
24
25messages = [
26 {"role": "system", "content": "Sei un assistente utile."},
27 {"role": "user", "content": "{prompt}"}
28]
29
30with torch.no_grad():
31 temp = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
32 inputs = tokenizer(temp, return_tensors="pt").to("cuda")
33
34 _ = model.generate(
35 **inputs,
36 streamer=streamer,
37 generation_config=gen
38 )1messages = [
2 {"role": "system", "content": "Fornisci una mindmap Mermaid sull'argomento in input."},
3 {"role": "user", "content": "Argomento: [argomento]"}
4]1schema = "[db schema]"
2messages = [
3 {"role": "system", "content": f"Sei un assistente SQL e il tuo compito è convertire la domanda dell'utente in codice SQL valido rispetto allo schema del database fornito.\n\nSchema:\n```sql\n{schema}\n```"},
4 {"role": "user", "content": "Conta il numero di X prodotti dall'azienda Y"}
5]1messages = [
2 {"role": "system", "content": "Sei un assistente utile."},
3 {"role": "user", "content": (
4 "Scrivi un articolo a partire dal titolo e dall'indice dei contenuti.\n\n"
5 "Titolo: [titolo]\n\n"
6 "Indice:\n\n"
7 "1. Introduzione\n"
8 "2. [heading]\n"
9 "..."
10 )}
11]safe, and it can refuse to answer to toxic questions.