Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,61 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- Intel/orca_dpo_pairs
|
4 |
+
base_model:
|
5 |
+
- Qwen/Qwen2.5-0.5B-Instruct
|
6 |
+
license: apache-2.0
|
7 |
+
---
|
8 |
+
# Fine-tuned Qwen/Qwen2.5-0.5B-Instruct Model
|
9 |
+
|
10 |
+
## Model Overview
|
11 |
+
|
12 |
+
This is a fine-tuned version of the Qwen/Qwen2.5-0.5B-Instruct model. The fine-tuning process utilized the Intel/orca_dpo_pairs dataset and applied DPO (Direct Preference Optimization) and LoRA (Low-Rank Adaptation) techniques.
|
13 |
+
|
14 |
+
**Note**: This fine-tuning was done following the instructions in [this blog](https://towardsdatascience.com/fine-tune-a-mistral-7b-model-with-direct-preference-optimization-708042745aac).
|
15 |
+
|
16 |
+
## Fine-tuning Details
|
17 |
+
|
18 |
+
- **Base Model**: Qwen/Qwen2.5-0.5B-Instruct
|
19 |
+
- **Dataset**: Intel/orca_dpo_pairs
|
20 |
+
- **Fine-tuning Method**: DPO + LoRA
|
21 |
+
|
22 |
+
## Usage Instructions
|
23 |
+
|
24 |
+
### Install Dependencies
|
25 |
+
|
26 |
+
Before using this model, make sure you have the following dependencies installed:
|
27 |
+
|
28 |
+
```bash
|
29 |
+
pip install transformers datasets
|
30 |
+
```
|
31 |
+
|
32 |
+
### Load the model
|
33 |
+
|
34 |
+
```python
|
35 |
+
import transformers
|
36 |
+
from transformers import AutoConfig, AutoModel, AutoTokenizer
|
37 |
+
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained("drive/MyDrive/result/Qwen-DPO")
|
39 |
+
|
40 |
+
message = [
|
41 |
+
{"role": "system", "content": "You are a helpful assistant chatbot."},
|
42 |
+
{"role": "user", "content": "What is a Large Language Model?"}
|
43 |
+
]
|
44 |
+
prompt = tokenizer.apply_chat_template(message, add_generation_prompt=True, tokenize=False)
|
45 |
+
|
46 |
+
pipeline = transformers.pipeline(
|
47 |
+
"text-generation",
|
48 |
+
model="co-gy/Qwen-DPO",
|
49 |
+
tokenizer=tokenizer
|
50 |
+
)
|
51 |
+
|
52 |
+
sequences = pipeline(
|
53 |
+
prompt,
|
54 |
+
do_sample=True,
|
55 |
+
temperature=0.7,
|
56 |
+
top_p=0.9,
|
57 |
+
num_return_sequences=1,
|
58 |
+
max_length=200,
|
59 |
+
)
|
60 |
+
print(sequences[0]['generated_text'])
|
61 |
+
```
|