Improve language tag
#2
by
lbourdois
- opened
README.md
CHANGED
@@ -1,108 +1,122 @@
|
|
1 |
-
---
|
2 |
-
base_model: Qwen/Qwen2.5-32B-Instruct
|
3 |
-
library_name: peft
|
4 |
-
license: apache-2.0
|
5 |
-
datasets:
|
6 |
-
- GAIR/LIMO
|
7 |
-
pipeline_tag: text-generation
|
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 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
```
|
|
|
1 |
+
---
|
2 |
+
base_model: Qwen/Qwen2.5-32B-Instruct
|
3 |
+
library_name: peft
|
4 |
+
license: apache-2.0
|
5 |
+
datasets:
|
6 |
+
- GAIR/LIMO
|
7 |
+
pipeline_tag: text-generation
|
8 |
+
language:
|
9 |
+
- zho
|
10 |
+
- eng
|
11 |
+
- fra
|
12 |
+
- spa
|
13 |
+
- por
|
14 |
+
- deu
|
15 |
+
- ita
|
16 |
+
- rus
|
17 |
+
- jpn
|
18 |
+
- kor
|
19 |
+
- vie
|
20 |
+
- tha
|
21 |
+
- ara
|
22 |
+
---
|
23 |
+
|
24 |
+
# qwen2.5-32b-instruct-limo-lora-adapter
|
25 |
+
|
26 |
+
This model is a fine-tuned version of [Qwen/Qwen2.5-32B-Instruct](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct) model. The fine-tuning was performed using Low-Rank Adaptation (LoRA) on the [LIMO dataset](https://huggingface.co/datasets/GAIR/LIMO) to enhance the model's reasoning capabilities, based on the work in the paper: [LIMO: Less is More for Reasoning](https://arxiv.org/pdf/2502.03387).
|
27 |
+
|
28 |
+
## Model description
|
29 |
+
|
30 |
+
- **Base Model**: [Qwen/Qwen2.5-32B-Instruct](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct)
|
31 |
+
- **Fine-Tuning Dataset**: [GAIR/LIMO](https://huggingface.co/datasets/GAIR/LIMO)
|
32 |
+
- **Fine-Tuning Method**: Low-Rank Adaptation (LoRA)
|
33 |
+
- **Library Used**: [peft](https://github.com/huggingface/peft)
|
34 |
+
- **License**: [Apache 2.0](LICENSE)
|
35 |
+
|
36 |
+
## Usage
|
37 |
+
|
38 |
+
To utilize this model for text generation tasks, follow the steps below:
|
39 |
+
|
40 |
+
### Installation
|
41 |
+
|
42 |
+
Ensure you have the necessary libraries installed:
|
43 |
+
|
44 |
+
```bash
|
45 |
+
pip install torch transformers peft
|
46 |
+
```
|
47 |
+
|
48 |
+
### Generating Text
|
49 |
+
|
50 |
+
```python
|
51 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
52 |
+
from peft import PeftModel
|
53 |
+
# Load the base model
|
54 |
+
base_model_name = "Qwen/Qwen2.5-32B-Instruct"
|
55 |
+
base_model = AutoModelForCausalLM.from_pretrained(base_model_name, torch_dtype="auto", device_map="auto")
|
56 |
+
# Load the tokenizer
|
57 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
|
58 |
+
# Load the LoRA adapter
|
59 |
+
adapter_path = "t83714/qwen2.5-32b-instruct-limo-lora-adapter"
|
60 |
+
model = PeftModel.from_pretrained(base_model, adapter_path)
|
61 |
+
prompt = "How much is (2+5)x5/7"
|
62 |
+
# Tokenize the input
|
63 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
64 |
+
# Generate the output
|
65 |
+
output = model.generate(**inputs, max_length=8000)
|
66 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
67 |
+
```
|
68 |
+
|
69 |
+
### Merge the adapter and export merged model
|
70 |
+
|
71 |
+
```python
|
72 |
+
from peft import PeftModel
|
73 |
+
from transformers import AutoModelForCausalLM
|
74 |
+
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-32B-Instruct")
|
75 |
+
# Load the LoRA adapter
|
76 |
+
adapter_path = "t83714/qwen2.5-32b-instruct-limo-lora-adapter"
|
77 |
+
model = PeftModel.from_pretrained(base_model, adapter_path)
|
78 |
+
merged_model = model.merge_and_unload()
|
79 |
+
merged_model.save_pretrained("./merged-model/")
|
80 |
+
```
|
81 |
+
|
82 |
+
## Training procedure
|
83 |
+
|
84 |
+
### Training hyperparameters
|
85 |
+
|
86 |
+
The following hyperparameters were used during training:
|
87 |
+
- learning_rate: 5e-06
|
88 |
+
- train_batch_size: 1
|
89 |
+
- eval_batch_size: 8
|
90 |
+
- seed: 42
|
91 |
+
- distributed_type: multi-GPU
|
92 |
+
- optimizer: Use adamw_torch with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
93 |
+
- generation_max_length: 16384
|
94 |
+
- lr_scheduler_type: cosine
|
95 |
+
- num_epochs: 15
|
96 |
+
- lora rank: 8
|
97 |
+
- lora target layers:
|
98 |
+
- v_proj
|
99 |
+
- o_proj
|
100 |
+
- q_proj
|
101 |
+
- k_proj
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
## Eval Result
|
106 |
+
|
107 |
+
[Math 500](https://github.com/GAIR-NLP/LIMO/blob/main/eval/data/math/test.jsonl) pass@1: 85%
|
108 |
+
|
109 |
+
|
110 |
+
## Acknowledgment
|
111 |
+
This model is trained based on the work of [Ye et al. (2025)](https://arxiv.org/abs/2502.03387). If you use this model, please also consider citing their paper:
|
112 |
+
```bibtex
|
113 |
+
@misc{ye2025limoreasoning,
|
114 |
+
title={LIMO: Less is More for Reasoning},
|
115 |
+
author={Yixin Ye and Zhen Huang and Yang Xiao and Ethan Chern and Shijie Xia and Pengfei Liu},
|
116 |
+
year={2025},
|
117 |
+
eprint={2502.03387},
|
118 |
+
archivePrefix={arXiv},
|
119 |
+
primaryClass={cs.CL},
|
120 |
+
url={https://arxiv.org/abs/2502.03387},
|
121 |
+
}
|
122 |
```
|