dfurman/Llama-3-70B-Orpo-v0.1

Model

2

stars

17

commits

1

linked in READMEs

Sep 6, 2024

updated

conversational
endpoints_compatible
llama
llama 3
model-index
orpo
rlhf
safetensors
sft
text-generation
text-generation-inference
transformers

README

dfurman/Llama-3-70B-Orpo-v0.1

This is an ORPO fine-tune of meta-llama/Meta-Llama-3-70B on 2k samples of mlabonne/orpo-dpo-mix-40k.

It's a successful fine-tune that follows the ChatML template!

πŸ”Ž Application

This model uses a context window of 8k. It was trained with the ChatML template.

πŸ† Evaluation

Open LLM Leaderboard

Model IDAverageARCHellaSwagMMLUTruthfulQAWinograndeGSM8K
meta-llama/Meta-Llama-3-70B-Instruct πŸ“„77.8871.4285.6980.0661.8182.8785.44
dfurman/Llama-3-70B-Orpo-v0.1 πŸ“„74.6768.6988.0179.3949.6285.4876.8
meta-llama/Meta-Llama-3-70B πŸ“„73.9668.7787.9879.2345.5685.3276.88

πŸ“ˆ Training curves

You can find the experiment on W&B at this address.

πŸ’» Usage

Setup
!pip install -qU transformers accelerate bitsandbytes

from transformers import AutoTokenizer, BitsAndBytesConfig
import transformers
import torch

if torch.cuda.get_device_capability()[0] >= 8:
    !pip install -qqq flash-attn
    attn_implementation = "flash_attention_2"
    torch_dtype = torch.bfloat16
else:
    attn_implementation = "eager"
    torch_dtype = torch.float16

bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch_dtype,
    bnb_4bit_use_double_quant=True,
)

model = "dfurman/Llama-3-70B-Orpo-v0.1"

tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    model_kwargs={
        "torch_dtype": torch_dtype,
        "quantization_config": bnb_config,
        "device_map": "auto",
        "attn_implementation": attn_implementation,
    }
)

Run

messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Tell me a recipe for a spicy margarita."},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
print("***Prompt:\n", prompt)

outputs = pipeline(prompt, max_new_tokens=1000, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print("***Generation:\n", outputs[0]["generated_text"][len(prompt):])
Output
"""
"""

Open LLM Leaderboard Evaluation Results

Detailed results can be found here

MetricValue
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

Contributors

dfurman

16 commits

dfurman/Llama-3-70B-Orpo-v0.1

Model

2

stars

17

commits

1

linked in READMEs

Sep 6, 2024

updated

conversational
endpoints_compatible
llama
llama 3
model-index
orpo
rlhf
safetensors
sft
text-generation
text-generation-inference
transformers

README

dfurman/Llama-3-70B-Orpo-v0.1

This is an ORPO fine-tune of meta-llama/Meta-Llama-3-70B on 2k samples of mlabonne/orpo-dpo-mix-40k.

It's a successful fine-tune that follows the ChatML template!

πŸ”Ž Application

This model uses a context window of 8k. It was trained with the ChatML template.

πŸ† Evaluation

Open LLM Leaderboard

Model IDAverageARCHellaSwagMMLUTruthfulQAWinograndeGSM8K
meta-llama/Meta-Llama-3-70B-Instruct πŸ“„77.8871.4285.6980.0661.8182.8785.44
dfurman/Llama-3-70B-Orpo-v0.1 πŸ“„74.6768.6988.0179.3949.6285.4876.8
meta-llama/Meta-Llama-3-70B πŸ“„73.9668.7787.9879.2345.5685.3276.88

πŸ“ˆ Training curves

You can find the experiment on W&B at this address.

πŸ’» Usage

Setup
!pip install -qU transformers accelerate bitsandbytes

from transformers import AutoTokenizer, BitsAndBytesConfig
import transformers
import torch

if torch.cuda.get_device_capability()[0] >= 8:
    !pip install -qqq flash-attn
    attn_implementation = "flash_attention_2"
    torch_dtype = torch.bfloat16
else:
    attn_implementation = "eager"
    torch_dtype = torch.float16

bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch_dtype,
    bnb_4bit_use_double_quant=True,
)

model = "dfurman/Llama-3-70B-Orpo-v0.1"

tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    model_kwargs={
        "torch_dtype": torch_dtype,
        "quantization_config": bnb_config,
        "device_map": "auto",
        "attn_implementation": attn_implementation,
    }
)

Run

messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Tell me a recipe for a spicy margarita."},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
print("***Prompt:\n", prompt)

outputs = pipeline(prompt, max_new_tokens=1000, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print("***Generation:\n", outputs[0]["generated_text"][len(prompt):])
Output
"""
"""

Open LLM Leaderboard Evaluation Results

Detailed results can be found here

MetricValue
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

Contributors

dfurman

16 commits