Update README.md
Browse files
README.md
CHANGED
@@ -84,7 +84,7 @@ sampling_params=SamplingParams(
|
|
84 |
skip_special_tokens=True,
|
85 |
temperature=0.0
|
86 |
)
|
87 |
-
# For the
|
88 |
import re
|
89 |
pattn=re.compile("\*\*Final Answer\*\*.*",re.S)
|
90 |
|
@@ -148,4 +148,19 @@ print("With budget forcing:")
|
|
148 |
print(prompt + o[0].outputs[0].text)
|
149 |
```
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
- PEFT 0.14.0
|
|
|
84 |
skip_special_tokens=True,
|
85 |
temperature=0.0
|
86 |
)
|
87 |
+
# For the math sample
|
88 |
import re
|
89 |
pattn=re.compile("\*\*Final Answer\*\*.*",re.S)
|
90 |
|
|
|
148 |
print(prompt + o[0].outputs[0].text)
|
149 |
```
|
150 |
|
151 |
+
## If you want to combine lora weights into one model then use the following code
|
152 |
+
|
153 |
+
```python
|
154 |
+
from peft import PeftModel
|
155 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
156 |
+
tokenizer = AutoTokenizer.from_pretrained("jiangchengchengNLP/qwen2.5-distill-QWQ")
|
157 |
+
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-7B-Instruct",device_map='cpu',torch_dtype="bfloat16")
|
158 |
+
model = PeftModel.from_pretrained(base_model, "jiangchengchengNLP/qwen2.5-distill-QWQ")
|
159 |
+
mergemodel = model.merge_and_unload()
|
160 |
+
mergemodel.save_pretrained("./merge_model")
|
161 |
+
tokenizer.save_pretrained("./merge_model")
|
162 |
+
print("model have merged!")
|
163 |
+
```
|
164 |
+
|
165 |
+
|
166 |
- PEFT 0.14.0
|