Views
No views yet

microsoft/Phi-3-mini-4k-instruct model.| Metric | Value |
|---|---|
| Avg. | 23.21 |
| IFEval (0-Shot) | 50.69 |
| BBH (3-Shot) | 37.73 |
| MATH Lvl 5 (4-Shot) | 2.34 |
| GPQA (0-shot) | 9.51 |
| MuSR (0-shot) | 7.70 |
| MMLU-PRO (5-shot) | 31.27 |
| Metric | Value |
|---|---|
| Avg. | 69.78 |
| AI2 Reasoning Challenge (25-Shot) | 62.80 |
| HellaSwag (10-Shot) | 80.76 |
| MMLU (5-Shot) | 69.10 |
| TruthfulQA (0-shot) | 59.97 |
| Winogrande (5-shot) | 72.45 |
| GSM8k (5-shot) | 73.62 |
ChatML prompt template:<|im_start|>system
{System}
<|im_end|>
<|im_start|>user
{User}
<|im_end|>
<|im_start|>assistant
{Assistant}MaziyarPanahi/calme-2.2-phi3-4b as the model name in Hugging Face's
transformers library.1from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
2from transformers import pipeline
3import torch
4
5model_id = "MaziyarPanahi/calme-2.2-phi3-4b"
6
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16,
10 device_map="auto",
11 trust_remote_code=True,
12 # attn_implementation="flash_attention_2"
13)
14
15tokenizer = AutoTokenizer.from_pretrained(
16 model_id,
17 trust_remote_code=True
18)
19
20streamer = TextStreamer(tokenizer)
21
22messages = [
23 {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
24 {"role": "user", "content": "Who are you?"},
25]
26
27# this should work perfectly for the model to stop generating
28terminators = [
29 tokenizer.eos_token_id, # this should be <|im_end|>
30 tokenizer.convert_tokens_to_ids("<|assistant|>"), # sometimes model stops generating at <|assistant|>
31 tokenizer.convert_tokens_to_ids("<|end|>") # sometimes model stops generating at <|end|>
32]
33
34pipe = pipeline(
35 "text-generation",
36 model=model,
37 tokenizer=tokenizer,
38)
39
40generation_args = {
41 "max_new_tokens": 500,
42 "return_full_text": False,
43 "temperature": 0.0,
44 "do_sample": False,
45 "streamer": streamer,
46 "eos_token_id": terminators,
47}
48
49output = pipe(messages, **generation_args)
50print(output[0]['generated_text'])
51
52