Views
No views yet
1<|im_start|>system
2You are a helpful assistant.<|im_end|>
3<|im_start|>user
4Question?<|im_end|>
5<|im_start|>assistant1<|im_start|>system
2You are a helpful assistant.<|im_end|>
3<|im_start|>user
4How to explain Internet for a medieval knight?<|im_end|>
5<|im_start|>assistant<|im_start|>assistant .1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
3
4torch.random.manual_seed(0)
5
6model_id = "rasyosef/Phi-1_5-Instruct-v0.1"
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 device_map="cuda",
10 torch_dtype="auto"
11)
12
13tokenizer = AutoTokenizer.from_pretrained(model_id)
14
15messages = [
16 {"role": "system", "content": "You are a helpful AI assistant."},
17 {"role": "user", "content": "Can you provide ways to eat combinations of bananas and dragonfruits?"},
18 {"role": "assistant", "content": "Sure! Here are some ways to eat bananas and dragonfruits together: 1. Banana and dragonfruit smoothie: Blend bananas and dragonfruits together with some milk and honey. 2. Banana and dragonfruit salad: Mix sliced bananas and dragonfruits together with some lemon juice and honey."},
19 {"role": "user", "content": "What about solving an 2x + 3 = 7 equation?"},
20]
21
22pipe = pipeline(
23 "text-generation",
24 model=model,
25 tokenizer=tokenizer,
26)
27
28generation_args = {
29 "max_new_tokens": 500,
30 "return_full_text": False,
31 "temperature": 0.0,
32 "do_sample": False,
33}
34
35output = pipe(messages, **generation_args)
36print(output[0]['generated_text']) | Model | Size (# params) | IFEval | GSM8K | MMLU | TruthfulQA | Winogrande |
|---|---|---|---|---|---|---|
| Phi-1_5-Instruct-v0.1 | 1.4B | 26.71 | 41.78 | 39.72 | 47.9 | 70.4 |
| SmolLM-1.7B-Instruct | 1.7B | 24.21 | 3.45 | 23.57 | 47.38 | 63.61 |
| TinyLlama-1.1B-Chat-v1.0 | 1.1B | 21.23 | 0 | 24.03 | 39.14 | 61.01 |
| phi-1_5 | 1.4B | 20.51 | 31.73 | 42.48 | 40.86 | 71.74 |