Views
No views yet
1import transformers
2from transformers import AutoTokenizer
3
4# Format prompt
5message = [
6 {"role": "system", "content": "You are a helpful assistant chatbot."},
7 {"role": "user", "content": "What is a Large Language Model?"}
8]
9tokenizer = AutoTokenizer.from_pretrained(new_model)
10prompt = tokenizer.apply_chat_template(message, add_generation_prompt=True, tokenize=False)
11
12# Create pipeline
13pipeline = transformers.pipeline(
14 "text-generation",
15 model=new_model,
16 tokenizer=tokenizer
17)
18
19# Generate text
20sequences = pipeline(
21 prompt,
22 do_sample=True,
23 temperature=0.7,
24 top_p=0.9,
25 num_return_sequences=1,
26 max_length=200,
27)
28print(sequences[0]['generated_text'])| Metric | Value |
|---|---|
| Avg. | 8.22 |
| IFEval (0-Shot) | 25.66 |
| BBH (3-Shot) | 10.26 |
| MATH Lvl 5 (4-Shot) | 0.76 |
| GPQA (0-shot) | 2.24 |
| MuSR (0-shot) | 3.40 |
| MMLU-PRO (5-shot) | 7.00 |