robinsmits/ChatAlpaca-20K
Viewer • Updated • 40k • 148 • 6
How to use robinsmits/Mistral-Instruct-7B-v0.2-ChatAlpaca with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
model = PeftModel.from_pretrained(base_model, "robinsmits/Mistral-Instruct-7B-v0.2-ChatAlpaca")This model is a fine-tuned version of mistralai/Mistral-7B-Instruct-v0.2 on the English robinsmits/ChatAlpaca-20K dataset.
It achieves the following results on the evaluation set:
A basic example of how to use the finetuned model. Note this example is a modified version from the base model.
import torch
from peft import AutoPeftModelForCausalLM
from transformers import AutoTokenizer
device = "cuda"
model = AutoPeftModelForCausalLM.from_pretrained("robinsmits/Mistral-Instruct-7B-v0.2-ChatAlpaca",
device_map = "auto",
load_in_4bit = True,
torch_dtype = torch.bfloat16)
tokenizer = AutoTokenizer.from_pretrained("robinsmits/Mistral-Instruct-7B-v0.2-ChatAlpaca")
messages = [
{"role": "user", "content": "What is your favourite condiment?"},
{"role": "assistant", "content": "Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!"},
{"role": "user", "content": "Do you have mayonnaise recipes?"}
]
encodeds = tokenizer.apply_chat_template(messages, return_tensors = "pt")
generated_ids = model.generate(input_ids = encodeds.to(device), max_new_tokens = 512, do_sample = True)
decoded = tokenizer.batch_decode(generated_ids)
print(decoded[0])
More information needed
More information needed
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 0.99 | 0.2 | 120 | 0.9355 |
| 0.8793 | 0.39 | 240 | 0.8848 |
| 0.8671 | 0.59 | 360 | 0.8737 |
| 0.8662 | 0.78 | 480 | 0.8679 |
| 0.8627 | 0.98 | 600 | 0.8639 |
| 0.8426 | 1.18 | 720 | 0.8615 |
| 0.8574 | 1.37 | 840 | 0.8598 |
| 0.8473 | 1.57 | 960 | 0.8589 |
| 0.8528 | 1.76 | 1080 | 0.8585 |
| 0.852 | 1.96 | 1200 | 0.8584 |
Detailed results can be found here
| Metric | Value |
|---|---|
| Avg. | 61.21 |
| AI2 Reasoning Challenge (25-Shot) | 56.74 |
| HellaSwag (10-Shot) | 80.82 |
| MMLU (5-Shot) | 59.10 |
| TruthfulQA (0-shot) | 55.86 |
| Winogrande (5-shot) | 77.11 |
| GSM8k (5-shot) | 37.60 |
Base model
mistralai/Mistral-7B-Instruct-v0.2