Views
No views yet

MaziyarPanahi/Llama-3-8B-Instruct-v0.8 model.| Metric | Value |
|---|---|
| Avg. | 73.29 |
| AI2 Reasoning Challenge (25-Shot) | 72.35 |
| HellaSwag (10-Shot) | 88.17 |
| MMLU (5-Shot) | 68.10 |
| TruthfulQA (0-shot) | 64.67 |
| Winogrande (5-shot) | 79.95 |
| GSM8k (5-shot) | 66.49 |
MaziyarPanahi/Llama-3-8B-Instruct-v0.9 is the 4th best-performing 8B model on the Open LLM Leaderboard. (03/06/2024).
ChatML prompt template:<|begin_of_text|><|start_header_id|>system<|end_header_id|>
{system_prompt}<|eot_id|><|start_header_id|>user<|end_header_id|>
{prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>MaziyarPanahi/Llama-3-8B-Instruct-v0.9 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/Llama-3-8B-Instruct-v0.9"
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
22pipeline = pipeline(
23 "text-generation",
24 model=model,
25 tokenizer=tokenizer,
26 model_kwargs={"torch_dtype": torch.bfloat16},
27 streamer=streamer
28)
29
30# Then you can use the pipeline to generate text.
31
32messages = [
33 {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
34 {"role": "user", "content": "Who are you?"},
35]
36
37prompt = tokenizer.apply_chat_template(
38 messages,
39 tokenize=False,
40 add_generation_prompt=True
41)
42
43terminators = [
44 tokenizer.eos_token_id,
45 tokenizer.convert_tokens_to_ids("<|eot_id|>")
46]
47
48outputs = pipeline(
49 prompt,
50 max_new_tokens=512,
51 eos_token_id=terminators,
52 do_sample=True,
53 temperature=0.6,
54 top_p=0.95,
55)
56print(outputs[0]["generated_text"][len(prompt):])