update README.md
Browse files
README.md
CHANGED
@@ -1,26 +1,88 @@
|
|
1 |
---
|
2 |
library_name: peft
|
3 |
-
license:
|
|
|
4 |
base_model: meta-llama/Llama-3.1-8B-Instruct
|
|
|
|
|
5 |
tags:
|
6 |
- llama-factory
|
7 |
- lora
|
8 |
- generated_from_trainer
|
|
|
|
|
|
|
|
|
9 |
model-index:
|
10 |
-
- name: lora
|
11 |
results: []
|
12 |
---
|
13 |
|
14 |
-
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
15 |
-
should probably proofread and complete it, then remove this comment. -->
|
16 |
|
17 |
-
# lora
|
18 |
|
19 |
-
This model is a fine-tuned version of [meta-llama/Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) on the
|
|
|
|
|
20 |
|
21 |
## Model description
|
22 |
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
## Intended uses & limitations
|
26 |
|
@@ -44,14 +106,27 @@ The following hyperparameters were used during training:
|
|
44 |
- lr_scheduler_type: cosine
|
45 |
- num_epochs: 15
|
46 |
|
47 |
-
### Training results
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
### Framework versions
|
52 |
|
53 |
- PEFT 0.12.0
|
54 |
- Transformers 4.49.0
|
55 |
- Pytorch 2.6.0+cu124
|
56 |
- Datasets 3.3.2
|
57 |
-
- Tokenizers 0.21.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
library_name: peft
|
3 |
+
license: apache-2.0
|
4 |
+
pipeline_tag: text-generation
|
5 |
base_model: meta-llama/Llama-3.1-8B-Instruct
|
6 |
+
datasets:
|
7 |
+
- GAIR/LIMO
|
8 |
tags:
|
9 |
- llama-factory
|
10 |
- lora
|
11 |
- generated_from_trainer
|
12 |
+
- chat
|
13 |
+
- Llama-3
|
14 |
+
- instruct
|
15 |
+
- finetune
|
16 |
model-index:
|
17 |
+
- name: llama-3.1-8b-instruct-limo-lora
|
18 |
results: []
|
19 |
---
|
20 |
|
|
|
|
|
21 |
|
22 |
+
# llama-3.1-8b-instruct-limo-lora
|
23 |
|
24 |
+
This model is a fine-tuned version of [meta-llama/Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-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).
|
25 |
+
|
26 |
+
This repo contains the LoRA adapter weights only. The merged model can be found from [here](https://huggingface.co/t83714/llama-3.1-8b-instruct-limo).
|
27 |
|
28 |
## Model description
|
29 |
|
30 |
+
- **Base Model**: [meta-llama/Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-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 |
+
|
54 |
+
# Load the base model
|
55 |
+
base_model_name = "meta-llama/Llama-3.1-8B-Instruct"
|
56 |
+
base_model = AutoModelForCausalLM.from_pretrained(base_model_name, torch_dtype="auto", device_map="auto")
|
57 |
+
|
58 |
+
# Load the tokenizer
|
59 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
|
60 |
+
|
61 |
+
# Load the LoRA adapter
|
62 |
+
adapter_path = "path_to_your_lora_adapter"
|
63 |
+
model = PeftModel.from_pretrained(base_model, adapter_path)
|
64 |
+
|
65 |
+
prompt = "Hello"
|
66 |
+
|
67 |
+
# Tokenize the input
|
68 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
69 |
+
|
70 |
+
# Generate the output
|
71 |
+
output = merged_model.generate(**inputs, max_length=200)
|
72 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
73 |
+
```
|
74 |
+
|
75 |
+
### Merge the adapter and export merged model
|
76 |
+
|
77 |
+
```python
|
78 |
+
from peft import PeftModel
|
79 |
+
from transformers import AutoModelForCausalLM
|
80 |
+
|
81 |
+
base_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
|
82 |
+
model = PeftModel.from_pretrained(base_model, "./")
|
83 |
+
merged_model = model.merge_and_unload()
|
84 |
+
merged_model.save_pretrained("./merged-model/")
|
85 |
+
```
|
86 |
|
87 |
## Intended uses & limitations
|
88 |
|
|
|
106 |
- lr_scheduler_type: cosine
|
107 |
- num_epochs: 15
|
108 |
|
|
|
|
|
|
|
|
|
109 |
### Framework versions
|
110 |
|
111 |
- PEFT 0.12.0
|
112 |
- Transformers 4.49.0
|
113 |
- Pytorch 2.6.0+cu124
|
114 |
- Datasets 3.3.2
|
115 |
+
- Tokenizers 0.21.0
|
116 |
+
|
117 |
+
|
118 |
+
## Acknowledgment
|
119 |
+
|
120 |
+
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:
|
121 |
+
|
122 |
+
```bibtex
|
123 |
+
@misc{ye2025limoreasoning,
|
124 |
+
title={LIMO: Less is More for Reasoning},
|
125 |
+
author={Yixin Ye and Zhen Huang and Yang Xiao and Ethan Chern and Shijie Xia and Pengfei Liu},
|
126 |
+
year={2025},
|
127 |
+
eprint={2502.03387},
|
128 |
+
archivePrefix={arXiv},
|
129 |
+
primaryClass={cs.CL},
|
130 |
+
url={https://arxiv.org/abs/2502.03387},
|
131 |
+
}
|
132 |
+
```
|