
| Model ID | Average | ARC | HellaSwag | MMLU | TruthfulQA | Winogrande | GSM8K |
|---|---|---|---|---|---|---|---|
| meta-llama/Meta-Llama-3-70B-Instruct 📄 | 77.88 | 71.42 | 85.69 | 80.06 | 61.81 | 82.87 | 85.44 |
| dfurman/Llama-3-70B-Orpo-v0.1 📄 | 74.67 | 68.69 | 88.01 | 79.39 | 49.62 | 85.48 | 76.8 |
| meta-llama/Meta-Llama-3-70B 📄 | 73.96 | 68.77 | 87.98 | 79.23 | 45.56 | 85.32 | 76.88 |
1!pip install -qU transformers accelerate bitsandbytes
2
3from transformers import AutoTokenizer, BitsAndBytesConfig
4import transformers
5import torch
6
7if torch.cuda.get_device_capability()[0] >= 8:
8 !pip install -qqq flash-attn
9 attn_implementation = "flash_attention_2"
10 torch_dtype = torch.bfloat16
11else:
12 attn_implementation = "eager"
13 torch_dtype = torch.float16
14
15bnb_config = BitsAndBytesConfig(
16 load_in_4bit=True,
17 bnb_4bit_quant_type="nf4",
18 bnb_4bit_compute_dtype=torch_dtype,
19 bnb_4bit_use_double_quant=True,
20)
21
22model = "dfurman/Llama-3-70B-Orpo-v0.1"
23
24tokenizer = AutoTokenizer.from_pretrained(model)
25pipeline = transformers.pipeline(
26 "text-generation",
27 model=model,
28 model_kwargs={
29 "torch_dtype": torch_dtype,
30 "quantization_config": bnb_config,
31 "device_map": "auto",
32 "attn_implementation": attn_implementation,
33 }
34)1messages = [
2 {"role": "system", "content": "You are a helpful assistant."},
3 {"role": "user", "content": "Tell me a recipe for a spicy margarita."},
4]
5prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
6print("***Prompt:\n", prompt)
7
8outputs = pipeline(prompt, max_new_tokens=1000, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
9print("***Generation:\n", outputs[0]["generated_text"][len(prompt):])"""
"""| Metric | Value |
|---|---|
| Avg. | 17.92 |
| IFEval (0-Shot) | 20.49 |
| BBH (3-Shot) | 24.09 |
| MATH Lvl 5 (4-Shot) | 13.52 |
| GPQA (0-shot) | 1.01 |
| MuSR (0-shot) | 16.28 |
| MMLU-PRO (5-shot) | 32.14 |