File size: 2,775 Bytes
8cade22 b3cccc6 8cade22 ef254df b3cccc6 ef254df b3cccc6 ef254df b3cccc6 ef254df 37d9421 ef254df 37d9421 eccfdcb 8cade22 37d9421 8cade22 075cc42 8cade22 654a623 37d9421 654a623 37d9421 8cade22 ef254df 8cade22 ef254df 37d9421 654a623 37d9421 ef254df 37d9421 ef254df 37d9421 ef254df 37d9421 654a623 37d9421 ef254df |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
---
license: apache-2.0
library_name: peft
tags:
- trl
- sft
- generated_from_trainer
base_model: mistralai/Mistral-7B-Instruct-v0.3
model-index:
- name: mistral-v0.3-vi-alpaca
results: []
language:
- vi
- en
pipeline_tag: text-generation
datasets:
- bkai-foundation-models/vi-alpaca
---
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->
[<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="200" height="32"/>](https://wandb.ai/date3k2/Fine%20tuning%20mistral%20Instruct%207B-v3/runs/w1jgfsao)
# Mistral-7B-Instruct-v0.3 LoRA
This model is a LoRA fine-tuned version of [mistralai/Mistral-7B-Instruct-v0.3](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3) on [bkai-foundation-models/vi-alpaca](https://huggingface.co/datasets/bkai-foundation-models/vi-alpaca) dataset.
It achieves the following results on the evaluation set:
- eval_loss: 0.4744
- eval_runtime: 241.8465
- eval_samples_per_second: 31.016
- eval_steps_per_second: 3.878
- epoch: 1.0
- step: 10627
## Usage
```python
# !pip install accelerate bitsandbytes peft
from transformers import AutoModelForCausalLM, BitsAndBytesConfig, AutoTokenizer
import torch
model_name = "mistralai/Mistral-7B-Instruct-v0.3"
peft_model_id = "date3k2/Mistral-7B-Instruct-vi-alpaca"
bnb_config = BitsAndBytesConfig(load_in_8bit=True)
model = AutoModelForCausalLM.from_pretrained(
model_name,
quantization_config=bnb_config,
device_map="auto",
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
model.load_adapter(peft_model_id)
device = "cuda"
messages = [
{
"role": "user",
"content": """You are a helpful Vietnamese AI chatbot. Below is an instruction that describes a task. Write a response that appropriately completes the request. Your response should be in Vietnamese.
Instruction:
Viết công thức để nấu một món ngon từ thịt bò.""",
},
]
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
model_inputs = encodeds.to(device)
generated_ids = model.generate(model_inputs, max_new_tokens=500, do_sample=True)
decoded = tokenizer.batch_decode(generated_ids)
print(decoded[0])
```
The following hyperparameters were used during training:
- learning_rate: 0.0002
- train_batch_size: 4
- eval_batch_size: 8
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: cosine
- lr_scheduler_warmup_ratio: 0.03
- num_epochs: 4
### Framework versions
- PEFT 0.11.1
- Transformers 4.41.1
- Pytorch 2.3.0+cu121
- Datasets 2.19.1
- Tokenizers 0.19.1 |