LoneStriker
commited on
Commit
•
95ecaaf
1
Parent(s):
816f075
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +397 -0
- added_tokens.json +4 -0
- config.json +26 -0
- model.safetensors.index.json +1 -0
- output.safetensors +3 -0
- special_tokens_map.json +27 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +62 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
assets/tab_1.png filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,397 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: text-generation
|
6 |
+
tags:
|
7 |
+
- mistral
|
8 |
+
- mixtral
|
9 |
+
- solar
|
10 |
+
- model-fusion
|
11 |
+
- fusechat
|
12 |
+
library_name: transformers
|
13 |
+
---
|
14 |
+
<p align="center" width="100%">
|
15 |
+
</p>
|
16 |
+
|
17 |
+
<div id="top" align="center">
|
18 |
+
|
19 |
+
<p style="font-size: 32px; font-weight: bold;">FuseChat: Knowledge Fusion of Chat Models</p>
|
20 |
+
|
21 |
+
|
22 |
+
<h4> |<a href="https://arxiv.org/abs/2402.16107"> 📑 Paper </a> |
|
23 |
+
<a href="https://huggingface.co/FuseAI"> 🤗 Huggingface Repo </a> |
|
24 |
+
<a href="https://github.com/fanqiwan/FuseLLM"> 🐱 Github Repo </a> |
|
25 |
+
</h4>
|
26 |
+
|
27 |
+
<!-- **Authors:** -->
|
28 |
+
|
29 |
+
_**Fanqi Wan, Ziyi Yang, Longguang Zhong, Xiaojun Quan, Xinting Huang, Wei Bi**_
|
30 |
+
|
31 |
+
|
32 |
+
<!-- **Affiliations:** -->
|
33 |
+
|
34 |
+
|
35 |
+
_Sun Yat-sen University_
|
36 |
+
|
37 |
+
<p align="center">
|
38 |
+
<img src="./assets/fig_0.png" width="70%"> <br>
|
39 |
+
</p>
|
40 |
+
|
41 |
+
</div>
|
42 |
+
|
43 |
+
|
44 |
+
## News
|
45 |
+
- **Feb 26, 2024:** 🔥 We release [FuseChat-7B-VaRM](https://huggingface.co/FuseAI/FuseChat-7B-VaRM), which is the fusion of three prominent chat LLMs with diverse architectures and scales, namely [NH2-Mixtral-8x7B](https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO), [NH2-Solar-10.7B](https://huggingface.co/NousResearch/Nous-Hermes-2-SOLAR-10.7B), and [OpenChat-3.5-7B](https://huggingface.co/openchat/openchat_3.5). FuseChat-7B-VaRM achieves an average performance of **8.22** on MT-Bench, outperforming various powerful chat LLMs at 7B and 34B scales like [Starling-7B](https://huggingface.co/berkeley-nest/Starling-LM-7B-alpha) and [Yi-34B-Chat](https://huggingface.co/01-ai/Yi-34B-Chat), even surpassing [GPT-3.5 (March)](https://platform.openai.com/docs/models/gpt-3-5-turbo), [Claude-2.1](https://www.anthropic.com/news/claude-2-1), and approaching [Mixtral-8x7B-Instruct](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1).
|
46 |
+
|
47 |
+
|
48 |
+
## Contents
|
49 |
+
|
50 |
+
- [Overview](#overview)
|
51 |
+
- [Model Release](#model-release)
|
52 |
+
- [Quick Start](#quick-start)
|
53 |
+
- [Data Construction](#data-construction)
|
54 |
+
- [Pairwise Knowledge Fusion](#pairwise-knowledge-fusion)
|
55 |
+
- [Model Merging](#model-merging)
|
56 |
+
- [Evaluation](#evaluation)
|
57 |
+
- [Citation](#citation)
|
58 |
+
|
59 |
+
## Overview
|
60 |
+
|
61 |
+
In this work, we propose an extended framework of FuseLLM to integrate the collective knowledge and individual strengths of multiple structure and scale-varied chat LLMs into a more powerful chat LLM, resulting in FuseChat. FuseChat adopts a fuse-then-merge strategy with two main stages. Firstly, it undertakes pairwise knowledge fusion for source LLMs to derive multiple target LLMs of identical structure and size via lightweight fine-tuning. Then, these target LLMs are merged within the parameter space, wherein we propose a novel method VaRM for determining the merging weights based on the variation ratio of parameter matrices before and after fine-tuning.
|
62 |
+
|
63 |
+
|
64 |
+
Moreover, we argue that the concept of knowledge fusion adopted by both FuseChat and FuseLLM shares a fundamentally similar purpose with other related topics, such as the recently popular topic of mixture of experts (MoEs), because they all aim to leverage the strengths of multiple models (experts). However, while MoEs require loading multiple experts during inference, which has higher memory requirements, knowledge fusion supports the integration of multiple LLMs with diverse architectures into a single LLM without any additional memory requirement, making it more memory-efficient.
|
65 |
+
|
66 |
+
<p align="center">
|
67 |
+
<img src="./assets/fig_1.png" width="95%"> <br>
|
68 |
+
</p>
|
69 |
+
|
70 |
+
|
71 |
+
## Model Release
|
72 |
+
|
73 |
+
We release [FuseChat-7B-VaRM](https://huggingface.co/FuseAI/FuseChat-7B-VaRM), which is the fusion of three prominent chat LLMs with diverse architectures and scales, namely [NH2-Mixtral-8x7B](https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO), [NH2-Solar-10.7B](https://huggingface.co/NousResearch/Nous-Hermes-2-SOLAR-10.7B), and [OpenChat-3.5-7B](https://huggingface.co/openchat/openchat_3.5).
|
74 |
+
|
75 |
+
To support a plug-and-play fusion of new source LLM, we release our target LLMs: [OpenChat-3.5-7B-Solar](https://huggingface.co/FuseAI/OpenChat-3.5-7B-Solar) and [OpenChat-3.5-7B-Mixtral](https://huggingface.co/FuseAI/OpenChat-3.5-7B-Mixtral), which are obtained from pair-wise knowledge fusion. Integrating a new source LLM at any scale requires only obtaining a target LLM from the new source LLM and merging it with the existing target LLMs.
|
76 |
+
|
77 |
+
We also release FuseChat with other merging methods: [FuseChat-7B-SLERP](https://huggingface.co/FuseAI/FuseChat-7B-SLERP) and [FuseChat-7B-TA](https://huggingface.co/FuseAI/FuseChat-7B-TA), which achieves an average performance of **8.19** and **8.20** on MT-Bench respectively.
|
78 |
+
|
79 |
+
Here are the evaluation results.
|
80 |
+
|
81 |
+
<p align="center">
|
82 |
+
<img src="./assets/tab_1.png" width="95%"> <br>
|
83 |
+
</p>
|
84 |
+
|
85 |
+
## Quick Start
|
86 |
+
|
87 |
+
### Setup
|
88 |
+
|
89 |
+
We use `python 3.11` in this project.
|
90 |
+
|
91 |
+
Then, we have to install all the libraries listed in `requirements.txt`.
|
92 |
+
|
93 |
+
```bash
|
94 |
+
pip install -r requirements.txt
|
95 |
+
```
|
96 |
+
|
97 |
+
### Usage
|
98 |
+
|
99 |
+
Here's how you can run the model using the 🤗 Transformers:
|
100 |
+
|
101 |
+
```python
|
102 |
+
import transformers
|
103 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained("FuseAI/FuseChat-7B-VaRM")
|
104 |
+
# Single-turn
|
105 |
+
tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant:").input_ids
|
106 |
+
assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
|
107 |
+
# Multi-turn
|
108 |
+
tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant: Hi<|end_of_turn|>GPT4 Correct User: How are you today?<|end_of_turn|>GPT4 Correct Assistant:").input_ids
|
109 |
+
assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747, 15359, 32000, 420, 6316, 28781, 3198, 3123, 1247, 28747, 1602, 460, 368, 3154, 28804, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
|
110 |
+
```
|
111 |
+
|
112 |
+
The GPT4 template is also available as the integrated `tokenizer.chat_template`, which can be used instead of manually specifying the template:
|
113 |
+
|
114 |
+
```python
|
115 |
+
messages = [
|
116 |
+
{"role": "user", "content": "Hello"},
|
117 |
+
{"role": "assistant", "content": "Hi"},
|
118 |
+
{"role": "user", "content": "How are you today?"}
|
119 |
+
]
|
120 |
+
tokens = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
|
121 |
+
assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747, 15359, 32000, 420, 6316, 28781, 3198, 3123, 1247, 28747, 1602, 460, 368, 3154, 28804, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
|
122 |
+
```
|
123 |
+
|
124 |
+
## Data Construction
|
125 |
+
|
126 |
+
We curated a comprehensive training dataset, [FuseChat-Mixture](https://huggingface.co/datasets/FuseAI/FuseChat-Mixture), from various sources. This dataset covers different styles and capabilities, featuring both human-written and model-generated, and spanning general instruction-following and specific skills.
|
127 |
+
|
128 |
+
Here we show the scripts to obtain representations from multiple source LLMs for model fusion.
|
129 |
+
|
130 |
+
1. Get representations for each source LLM
|
131 |
+
|
132 |
+
```bash
|
133 |
+
# We split the dataset into 4 splits, then process each split on one or multiple GPU.
|
134 |
+
|
135 |
+
# OpenChat-3.5-7B
|
136 |
+
export CUDA_VISIBLE_DEVICES=0
|
137 |
+
for i in {0..3}; do
|
138 |
+
python /train/get_data_representation.py \
|
139 |
+
--model_name_or_path "openchat/openchat_3.5" \
|
140 |
+
--data_path "/data/fusechat_v1_clean_split_2048_filter_wrong.json" \
|
141 |
+
--dataset_save_dir "<${i}_4_path_to_openchat_representation>" \
|
142 |
+
--tknz_dataset_path "<${i}_4_path_to_openchat_tknz>" \
|
143 |
+
--cache_dir "/.cache/huggingface/datasets" \
|
144 |
+
--model_max_length 2048 \
|
145 |
+
--load_in_half bf16 \
|
146 |
+
--batch_size 32 \
|
147 |
+
--top_k_logits 10 \
|
148 |
+
--save_per_token_metric \
|
149 |
+
--no_assert \
|
150 |
+
--conv_temp "openchat" \
|
151 |
+
--flash_attn_transformers \
|
152 |
+
--mask_instruction \
|
153 |
+
--dataset_split_num 4 \
|
154 |
+
--dataset_index ${i}
|
155 |
+
done
|
156 |
+
|
157 |
+
# NH2-Mixtral-8x7B
|
158 |
+
export CUDA_VISIBLE_DEVICES=0,1,2
|
159 |
+
for i in {0..3}; do
|
160 |
+
python /train/get_data_representation.py \
|
161 |
+
--model_name_or_path "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO" \
|
162 |
+
--data_path "/data/fusechat_v1_clean_split_2048_filter_wrong.json" \
|
163 |
+
--dataset_save_dir "<${i}_4_path_to_mixtral_representation>" \
|
164 |
+
--tknz_dataset_path "<${i}_4_path_to_mixtral_tknz>" \
|
165 |
+
--cache_dir "/.cache/huggingface/datasets" \
|
166 |
+
--model_max_length 2048 \
|
167 |
+
--load_in_half bf16 \
|
168 |
+
--batch_size 4 \
|
169 |
+
--top_k_logits 10 \
|
170 |
+
--save_per_token_metric \
|
171 |
+
--no_assert \
|
172 |
+
--conv_temp "openchat" \
|
173 |
+
--flash_attn_transformers \
|
174 |
+
--mask_instruction \
|
175 |
+
--device_map "auto" \
|
176 |
+
--dataset_split_num 4 \
|
177 |
+
--dataset_index ${i}
|
178 |
+
done
|
179 |
+
|
180 |
+
# NH2-Solar-10.7B
|
181 |
+
export CUDA_VISIBLE_DEVICES=0
|
182 |
+
for i in {0..3}; do
|
183 |
+
python /train/get_data_representation.py \
|
184 |
+
--model_name_or_path "NousResearch/Nous-Hermes-2-SOLAR-10.7B" \
|
185 |
+
--data_path "/data/fusechat_v1_clean_split_2048_filter_wrong.json" \
|
186 |
+
--dataset_save_dir "<${i}_4_path_to_solar_representation>" \
|
187 |
+
--tknz_dataset_path "<${i}_4_path_to_solar_tknz>" \
|
188 |
+
--cache_dir "/.cache/huggingface/datasets" \
|
189 |
+
--model_max_length 2048 \
|
190 |
+
--load_in_half bf16 \
|
191 |
+
--batch_size 8 \
|
192 |
+
--top_k_logits 10 \
|
193 |
+
--save_per_token_metric \
|
194 |
+
--no_assert \
|
195 |
+
--conv_temp "openchat" \
|
196 |
+
--flash_attn_transformers \
|
197 |
+
--mask_instruction \
|
198 |
+
--dataset_split_num 4 \
|
199 |
+
--dataset_index ${i}
|
200 |
+
done
|
201 |
+
```
|
202 |
+
|
203 |
+
2. Align representations from different source LLMs
|
204 |
+
|
205 |
+
```bash
|
206 |
+
# Since the tokenizers and vocabularies of these source LLMs are identical, we do not align.
|
207 |
+
|
208 |
+
# OpenChat-3.5-7B <-> NH2-Mixtral-8x7B
|
209 |
+
for i in {0..3}; do
|
210 |
+
python /train/replace_model.py \
|
211 |
+
--dataset_dir "<${i}_4_path_to_openchat_representation>" \
|
212 |
+
--replace_dataset_dir "<${i}_4_path_to_mixtral_representation>" \
|
213 |
+
--dataset_save_dir "<${i}_4_path_to_openchat_mixtral_representation>" \
|
214 |
+
--preprocessing_num_workers 64 \
|
215 |
+
--batch_size 1000 \
|
216 |
+
--replace_model model_0
|
217 |
+
done
|
218 |
+
|
219 |
+
# OpenChat-3.5-7B <-> NH2-Solar-10.7B
|
220 |
+
for i in {0..3}; do
|
221 |
+
python /train/replace_model.py \
|
222 |
+
--dataset_dir "<${i}_4_path_to_openchat_mixtral_representation>" \
|
223 |
+
--replace_dataset_dir "<${i}_4_path_to_solar_representation>" \
|
224 |
+
--dataset_save_dir "<${i}_4_path_to_openchat_mixtral_solar_representation>" \
|
225 |
+
--preprocessing_num_workers 64 \
|
226 |
+
--batch_size 1000 \
|
227 |
+
--replace_model model_1
|
228 |
+
done
|
229 |
+
```
|
230 |
+
|
231 |
+
3. Filter instances with NaN loss in the dataset
|
232 |
+
|
233 |
+
```bash
|
234 |
+
for i in {0..3}; do
|
235 |
+
python /train/filter_nan.py \
|
236 |
+
--input_data_dir "<${i}_4_path_to_openchat_mixtral_solar_representation>" \
|
237 |
+
--output_data_dir "<${i}_4_path_to_openchat_mixtral_solar_representation_fnan>"
|
238 |
+
done
|
239 |
+
```
|
240 |
+
|
241 |
+
The final processed data is at `<${i}_4_path_to_openchat_mixtral_solar_representation_fnan>`.
|
242 |
+
|
243 |
+
## Pairwise Knowledge Fusion
|
244 |
+
|
245 |
+
We show the scripts for pairwise knowledge fusion.
|
246 |
+
|
247 |
+
```bash
|
248 |
+
# OpenChat-3.5-7B <-> NH2-Mixtral-8x7B
|
249 |
+
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
|
250 |
+
torchrun --nproc_per_node=8 --master_port=20001 /train/train.py \
|
251 |
+
--model_name_or_path "openchat/openchat_3.5" \
|
252 |
+
--data_path "<0_4_path_to_openchat_mixtral_solar_representation_fnan>,<1_4_path_to_openchat_mixtral_solar_representation_fnan>,<2_4_path_to_openchat_mixtral_solar_representation_fnan>,<3_4_path_to_openchat_mixtral_solar_representation_fnan>" \
|
253 |
+
--bf16 True \
|
254 |
+
--output_dir "<path_to_save_openchat_mixtral_ckpt>" \
|
255 |
+
--num_train_epochs 3 \
|
256 |
+
--per_device_train_batch_size 4 \
|
257 |
+
--per_device_eval_batch_size 4 \
|
258 |
+
--gradient_accumulation_steps 4 \
|
259 |
+
--evaluation_strategy "no" \
|
260 |
+
--save_strategy "epoch" \
|
261 |
+
--save_steps 10000 \
|
262 |
+
--save_total_limit 5 \
|
263 |
+
--learning_rate 5e-6 \
|
264 |
+
--weight_decay 0. \
|
265 |
+
--warmup_ratio 0.03 \
|
266 |
+
--lr_scheduler_type "cosine" \
|
267 |
+
--logging_steps 1 \
|
268 |
+
--fsdp "full_shard auto_wrap" \
|
269 |
+
--fsdp_transformer_layer_cls_to_wrap 'MistralDecoderLayer' \
|
270 |
+
--tf32 True \
|
271 |
+
--model_max_length 2048 \
|
272 |
+
--gradient_checkpointing True \
|
273 |
+
--conv_temp "openchat" \
|
274 |
+
--lazy_preprocess True \
|
275 |
+
--flash_attn_transformers True \
|
276 |
+
--do_train \
|
277 |
+
--do_distill \
|
278 |
+
--distill_with_ref_model True \
|
279 |
+
--distill_with_aligned_model_0 True \
|
280 |
+
--distill_with_aligned_model_1 False \
|
281 |
+
--distill_loss_type "ce" \
|
282 |
+
--distill_teacher_temperature 1.0 \
|
283 |
+
--lm_loss_weight 0.9 \
|
284 |
+
--distill_greater_as_gt True \
|
285 |
+
--distill_greater_as_gt_type hard \
|
286 |
+
--dataloader_num_workers 8 \
|
287 |
+
--remove_unused_columns False
|
288 |
+
|
289 |
+
# OpenChat-3.5-7B <-> NH2-Solar-10.7B
|
290 |
+
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
|
291 |
+
torchrun --nproc_per_node=8 --master_port=20001 /train/train.py \
|
292 |
+
--model_name_or_path "openchat/openchat_3.5" \
|
293 |
+
--data_path "<0_4_path_to_openchat_mixtral_solar_representation_fnan>,<1_4_path_to_openchat_mixtral_solar_representation_fnan>,<2_4_path_to_openchat_mixtral_solar_representation_fnan>,<3_4_path_to_openchat_mixtral_solar_representation_fnan>" \
|
294 |
+
--bf16 True \
|
295 |
+
--output_dir "<path_to_save_openchat_solar_ckpt>" \
|
296 |
+
--num_train_epochs 3 \
|
297 |
+
--per_device_train_batch_size 4 \
|
298 |
+
--per_device_eval_batch_size 4 \
|
299 |
+
--gradient_accumulation_steps 4 \
|
300 |
+
--evaluation_strategy "no" \
|
301 |
+
--save_strategy "epoch" \
|
302 |
+
--save_steps 10000 \
|
303 |
+
--save_total_limit 5 \
|
304 |
+
--learning_rate 5e-6 \
|
305 |
+
--weight_decay 0. \
|
306 |
+
--warmup_ratio 0.03 \
|
307 |
+
--lr_scheduler_type "cosine" \
|
308 |
+
--logging_steps 1 \
|
309 |
+
--fsdp "full_shard auto_wrap" \
|
310 |
+
--fsdp_transformer_layer_cls_to_wrap 'MistralDecoderLayer' \
|
311 |
+
--tf32 True \
|
312 |
+
--model_max_length 2048 \
|
313 |
+
--gradient_checkpointing True \
|
314 |
+
--conv_temp "openchat" \
|
315 |
+
--lazy_preprocess True \
|
316 |
+
--flash_attn_transformers True \
|
317 |
+
--do_train \
|
318 |
+
--do_distill \
|
319 |
+
--distill_with_ref_model True \
|
320 |
+
--distill_with_aligned_model_0 False \
|
321 |
+
--distill_with_aligned_model_1 True \
|
322 |
+
--distill_loss_type "ce" \
|
323 |
+
--distill_teacher_temperature 1.0 \
|
324 |
+
--lm_loss_weight 0.9 \
|
325 |
+
--distill_greater_as_gt True \
|
326 |
+
--distill_greater_as_gt_type hard \
|
327 |
+
--dataloader_num_workers 8 \
|
328 |
+
--remove_unused_columns False
|
329 |
+
```
|
330 |
+
|
331 |
+
## Model Merging
|
332 |
+
|
333 |
+
We show the scripts to obtain the final FuseChat using different merging methods.
|
334 |
+
|
335 |
+
```bash
|
336 |
+
# For "slerp", "ta", "ties", and "dare" methods
|
337 |
+
export CUDA_VISIBLE_DEVICES=0
|
338 |
+
mergekit-yaml merge/mergekit_configs/fusechat-slerp.yml "<path_to_save_fusechat_7b_slerp>"
|
339 |
+
mergekit-yaml merge/mergekit_configs/fusechat-ta.yml "<path_to_save_fusechat_7b_ta>"
|
340 |
+
mergekit-yaml merge/mergekit_configs/fusechat-ties.yml "<path_to_save_fusechat_7b_ties>"
|
341 |
+
mergekit-yaml merge/mergekit_configs/fusechat-dare.yml "<path_to_save_fusechat_7b_dare>"
|
342 |
+
|
343 |
+
# For "linear" method
|
344 |
+
python merge/VaRM/merge.py \
|
345 |
+
--merged_model_names "FuseAI/OpenChat-3.5-7B-Mixtral,FuseAI/OpenChat-3.5-7B-Solar" \
|
346 |
+
--merged_model_save_dir "<path_to_save_fusechat_7b_linear>" \
|
347 |
+
--merge_method "linear" \
|
348 |
+
--linear_weights "1,2"
|
349 |
+
|
350 |
+
# For our "varm" method
|
351 |
+
python merge/VaRM/analysis.py \
|
352 |
+
--model1_path "FuseAI/OpenChat-3.5-7B-Mixtral" \
|
353 |
+
--model2_path "FuseAI/OpenChat-3.5-7B-Solar" \
|
354 |
+
--save_path "<path_to_save_analysis_result>/analysis.json" \
|
355 |
+
--merge_type "square"
|
356 |
+
|
357 |
+
python merge/VaRM/merge.py \
|
358 |
+
--merged_model_names "FuseAI/OpenChat-3.5-7B-Mixtral,FuseAI/OpenChat-3.5-7B-Solar" \
|
359 |
+
--analysis_result "<path_to_save_analysis_result>/analysis.json" \
|
360 |
+
--merged_model_save_dir "<path_to_save_fusechat_7b_varm>" \
|
361 |
+
--merge_method "avg_param" \
|
362 |
+
--merge_type "square"
|
363 |
+
```
|
364 |
+
|
365 |
+
## Evaluation
|
366 |
+
|
367 |
+
We evaluate FuseChat on MT-Bench, which comprises 80 multi-turn dialogues spanning writing, roleplay, reasoning, math, coding, stem, and humanities domains. Please download the [official code](https://github.com/lm-sys/FastChat/tree/main/fastchat/llm_judge) and follow the guidelines for evaluation. We provide the scripts for our evaluation.
|
368 |
+
|
369 |
+
```bash
|
370 |
+
# Step 1. Generate model answers to MT-bench questions
|
371 |
+
export CUDA_VISIBLE_DEVICES=0,1
|
372 |
+
python gen_model_answer.py \
|
373 |
+
--model-path "FuseAI/FuseChat-7B-VaRM" \
|
374 |
+
--model-id "openchat_3.5_fusechat_7b_varm" \
|
375 |
+
--num-gpus-per-model 1 \
|
376 |
+
--num-gpus-total 2
|
377 |
+
|
378 |
+
# Step 2. Generate GPT-4 judgments
|
379 |
+
export OPENAI_API_KEY=XXXXXX # set the OpenAI API key
|
380 |
+
python gen_judgment.py \
|
381 |
+
--parallel 2
|
382 |
+
|
383 |
+
# Step 3. Show MT-bench scores
|
384 |
+
python show_result.py
|
385 |
+
```
|
386 |
+
|
387 |
+
## Citation
|
388 |
+
|
389 |
+
If you find this work is relevant with your research or applications, please feel free to cite our work!
|
390 |
+
```
|
391 |
+
@article{wan2024fusechat,
|
392 |
+
title={FuseChat: Knowledge Fusion of Chat Models},
|
393 |
+
author={Fanqi Wan and Ziyi Yang and Longguang Zhong and Xiaojun Quan and Xinting Huang and Wei Bi},
|
394 |
+
journal={arXiv preprint arXiv:2402.16107},
|
395 |
+
year={2024}
|
396 |
+
}
|
397 |
+
```
|
added_tokens.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"<|end_of_turn|>": 32000,
|
3 |
+
"<|pad_0|>": 32001
|
4 |
+
}
|
config.json
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/data/wanfq/agno_fusion/fusechat_models/fusechat_v1_nous_hermes_mixtral_teacher_e3",
|
3 |
+
"architectures": [
|
4 |
+
"MistralForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 1,
|
8 |
+
"eos_token_id": 32000,
|
9 |
+
"hidden_act": "silu",
|
10 |
+
"hidden_size": 4096,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 14336,
|
13 |
+
"max_position_embeddings": 8192,
|
14 |
+
"model_type": "mistral",
|
15 |
+
"num_attention_heads": 32,
|
16 |
+
"num_hidden_layers": 32,
|
17 |
+
"num_key_value_heads": 8,
|
18 |
+
"rms_norm_eps": 1e-05,
|
19 |
+
"rope_theta": 10000.0,
|
20 |
+
"sliding_window": 4096,
|
21 |
+
"tie_word_embeddings": false,
|
22 |
+
"torch_dtype": "bfloat16",
|
23 |
+
"transformers_version": "4.36.0",
|
24 |
+
"use_cache": true,
|
25 |
+
"vocab_size": 32002
|
26 |
+
}
|
model.safetensors.index.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"metadata": {"mergekit_version": "0.0.3.1"}, "weight_map": {"model.embed_tokens.weight": "model-00001-of-00002.safetensors", "model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.0.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.1.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.10.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.10.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.2.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.3.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.4.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.4.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.5.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.5.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.6.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.6.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.7.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.7.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.8.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.8.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.9.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.9.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.11.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.11.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.12.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.12.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.13.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.13.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.14.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.14.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.15.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.15.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.16.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.16.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.17.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.17.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.18.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.18.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.18.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.18.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.18.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.19.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.19.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.19.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.19.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.19.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.19.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.19.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.19.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.19.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.20.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.20.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.20.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.20.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.20.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.20.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.20.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.20.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.20.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.21.input_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.21.mlp.down_proj.weight": "model-00001-of-00002.safetensors", "model.layers.21.mlp.gate_proj.weight": "model-00001-of-00002.safetensors", "model.layers.21.mlp.up_proj.weight": "model-00001-of-00002.safetensors", "model.layers.21.post_attention_layernorm.weight": "model-00001-of-00002.safetensors", "model.layers.21.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.21.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.21.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.21.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "model.layers.22.self_attn.k_proj.weight": "model-00001-of-00002.safetensors", "model.layers.22.self_attn.o_proj.weight": "model-00001-of-00002.safetensors", "model.layers.22.self_attn.q_proj.weight": "model-00001-of-00002.safetensors", "model.layers.22.self_attn.v_proj.weight": "model-00001-of-00002.safetensors", "lm_head.weight": "model-00002-of-00002.safetensors", "model.layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.22.mlp.down_proj.weight": "model-00002-of-00002.safetensors", "model.layers.22.mlp.gate_proj.weight": "model-00002-of-00002.safetensors", "model.layers.22.mlp.up_proj.weight": "model-00002-of-00002.safetensors", "model.layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.23.mlp.down_proj.weight": "model-00002-of-00002.safetensors", "model.layers.23.mlp.gate_proj.weight": "model-00002-of-00002.safetensors", "model.layers.23.mlp.up_proj.weight": "model-00002-of-00002.safetensors", "model.layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.23.self_attn.k_proj.weight": "model-00002-of-00002.safetensors", "model.layers.23.self_attn.o_proj.weight": "model-00002-of-00002.safetensors", "model.layers.23.self_attn.q_proj.weight": "model-00002-of-00002.safetensors", "model.layers.23.self_attn.v_proj.weight": "model-00002-of-00002.safetensors", "model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors", "model.layers.24.mlp.gate_proj.weight": "model-00002-of-00002.safetensors", "model.layers.24.mlp.up_proj.weight": "model-00002-of-00002.safetensors", "model.layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.24.self_attn.k_proj.weight": "model-00002-of-00002.safetensors", "model.layers.24.self_attn.o_proj.weight": "model-00002-of-00002.safetensors", "model.layers.24.self_attn.q_proj.weight": "model-00002-of-00002.safetensors", "model.layers.24.self_attn.v_proj.weight": "model-00002-of-00002.safetensors", "model.layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.25.mlp.down_proj.weight": "model-00002-of-00002.safetensors", "model.layers.25.mlp.gate_proj.weight": "model-00002-of-00002.safetensors", "model.layers.25.mlp.up_proj.weight": "model-00002-of-00002.safetensors", "model.layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.25.self_attn.k_proj.weight": "model-00002-of-00002.safetensors", "model.layers.25.self_attn.o_proj.weight": "model-00002-of-00002.safetensors", "model.layers.25.self_attn.q_proj.weight": "model-00002-of-00002.safetensors", "model.layers.25.self_attn.v_proj.weight": "model-00002-of-00002.safetensors", "model.layers.26.input_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.26.mlp.down_proj.weight": "model-00002-of-00002.safetensors", "model.layers.26.mlp.gate_proj.weight": "model-00002-of-00002.safetensors", "model.layers.26.mlp.up_proj.weight": "model-00002-of-00002.safetensors", "model.layers.26.post_attention_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.26.self_attn.k_proj.weight": "model-00002-of-00002.safetensors", "model.layers.26.self_attn.o_proj.weight": "model-00002-of-00002.safetensors", "model.layers.26.self_attn.q_proj.weight": "model-00002-of-00002.safetensors", "model.layers.26.self_attn.v_proj.weight": "model-00002-of-00002.safetensors", "model.layers.27.input_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.27.mlp.down_proj.weight": "model-00002-of-00002.safetensors", "model.layers.27.mlp.gate_proj.weight": "model-00002-of-00002.safetensors", "model.layers.27.mlp.up_proj.weight": "model-00002-of-00002.safetensors", "model.layers.27.post_attention_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.27.self_attn.k_proj.weight": "model-00002-of-00002.safetensors", "model.layers.27.self_attn.o_proj.weight": "model-00002-of-00002.safetensors", "model.layers.27.self_attn.q_proj.weight": "model-00002-of-00002.safetensors", "model.layers.27.self_attn.v_proj.weight": "model-00002-of-00002.safetensors", "model.layers.28.input_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.28.mlp.down_proj.weight": "model-00002-of-00002.safetensors", "model.layers.28.mlp.gate_proj.weight": "model-00002-of-00002.safetensors", "model.layers.28.mlp.up_proj.weight": "model-00002-of-00002.safetensors", "model.layers.28.post_attention_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.28.self_attn.k_proj.weight": "model-00002-of-00002.safetensors", "model.layers.28.self_attn.o_proj.weight": "model-00002-of-00002.safetensors", "model.layers.28.self_attn.q_proj.weight": "model-00002-of-00002.safetensors", "model.layers.28.self_attn.v_proj.weight": "model-00002-of-00002.safetensors", "model.layers.29.input_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.29.mlp.down_proj.weight": "model-00002-of-00002.safetensors", "model.layers.29.mlp.gate_proj.weight": "model-00002-of-00002.safetensors", "model.layers.29.mlp.up_proj.weight": "model-00002-of-00002.safetensors", "model.layers.29.post_attention_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.29.self_attn.k_proj.weight": "model-00002-of-00002.safetensors", "model.layers.29.self_attn.o_proj.weight": "model-00002-of-00002.safetensors", "model.layers.29.self_attn.q_proj.weight": "model-00002-of-00002.safetensors", "model.layers.29.self_attn.v_proj.weight": "model-00002-of-00002.safetensors", "model.layers.30.input_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.30.mlp.down_proj.weight": "model-00002-of-00002.safetensors", "model.layers.30.mlp.gate_proj.weight": "model-00002-of-00002.safetensors", "model.layers.30.mlp.up_proj.weight": "model-00002-of-00002.safetensors", "model.layers.30.post_attention_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.30.self_attn.k_proj.weight": "model-00002-of-00002.safetensors", "model.layers.30.self_attn.o_proj.weight": "model-00002-of-00002.safetensors", "model.layers.30.self_attn.q_proj.weight": "model-00002-of-00002.safetensors", "model.layers.30.self_attn.v_proj.weight": "model-00002-of-00002.safetensors", "model.layers.31.input_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.31.mlp.down_proj.weight": "model-00002-of-00002.safetensors", "model.layers.31.mlp.gate_proj.weight": "model-00002-of-00002.safetensors", "model.layers.31.mlp.up_proj.weight": "model-00002-of-00002.safetensors", "model.layers.31.post_attention_layernorm.weight": "model-00002-of-00002.safetensors", "model.layers.31.self_attn.k_proj.weight": "model-00002-of-00002.safetensors", "model.layers.31.self_attn.o_proj.weight": "model-00002-of-00002.safetensors", "model.layers.31.self_attn.q_proj.weight": "model-00002-of-00002.safetensors", "model.layers.31.self_attn.v_proj.weight": "model-00002-of-00002.safetensors", "model.norm.weight": "model-00002-of-00002.safetensors"}}
|
output.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2c2d8ae888c8c632560900564ca745106ac324ddf8d7247aef837e37c6d9508b
|
3 |
+
size 3855452352
|
special_tokens_map.json
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"additional_special_tokens": [
|
3 |
+
"<|end_of_turn|>",
|
4 |
+
"<|pad_0|>"
|
5 |
+
],
|
6 |
+
"bos_token": {
|
7 |
+
"content": "<s>",
|
8 |
+
"lstrip": false,
|
9 |
+
"normalized": false,
|
10 |
+
"rstrip": false,
|
11 |
+
"single_word": false
|
12 |
+
},
|
13 |
+
"eos_token": {
|
14 |
+
"content": "<|end_of_turn|>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": false,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false
|
19 |
+
},
|
20 |
+
"unk_token": {
|
21 |
+
"content": "<unk>",
|
22 |
+
"lstrip": false,
|
23 |
+
"normalized": false,
|
24 |
+
"rstrip": false,
|
25 |
+
"single_word": false
|
26 |
+
}
|
27 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
|
3 |
+
size 493443
|
tokenizer_config.json
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"added_tokens_decoder": {
|
5 |
+
"0": {
|
6 |
+
"content": "<unk>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": false,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false,
|
11 |
+
"special": true
|
12 |
+
},
|
13 |
+
"1": {
|
14 |
+
"content": "<s>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": false,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false,
|
19 |
+
"special": true
|
20 |
+
},
|
21 |
+
"2": {
|
22 |
+
"content": "</s>",
|
23 |
+
"lstrip": false,
|
24 |
+
"normalized": false,
|
25 |
+
"rstrip": false,
|
26 |
+
"single_word": false,
|
27 |
+
"special": true
|
28 |
+
},
|
29 |
+
"32000": {
|
30 |
+
"content": "<|end_of_turn|>",
|
31 |
+
"lstrip": false,
|
32 |
+
"normalized": false,
|
33 |
+
"rstrip": false,
|
34 |
+
"single_word": false,
|
35 |
+
"special": true
|
36 |
+
},
|
37 |
+
"32001": {
|
38 |
+
"content": "<|pad_0|>",
|
39 |
+
"lstrip": false,
|
40 |
+
"normalized": false,
|
41 |
+
"rstrip": false,
|
42 |
+
"single_word": false,
|
43 |
+
"special": true
|
44 |
+
}
|
45 |
+
},
|
46 |
+
"additional_special_tokens": [
|
47 |
+
"<|end_of_turn|>",
|
48 |
+
"<|pad_0|>"
|
49 |
+
],
|
50 |
+
"bos_token": "<s>",
|
51 |
+
"chat_template": "{{ bos_token }}{% for message in messages %}{{ 'GPT4 Correct ' + message['role'].title() + ': ' + message['content'] + '<|end_of_turn|>'}}{% endfor %}{% if add_generation_prompt %}{{ 'GPT4 Correct Assistant:' }}{% endif %}",
|
52 |
+
"clean_up_tokenization_spaces": false,
|
53 |
+
"eos_token": "<|end_of_turn|>",
|
54 |
+
"legacy": true,
|
55 |
+
"model_max_length": 1000000000000000019884624838656,
|
56 |
+
"pad_token": null,
|
57 |
+
"sp_model_kwargs": {},
|
58 |
+
"spaces_between_special_tokens": false,
|
59 |
+
"tokenizer_class": "LlamaTokenizer",
|
60 |
+
"unk_token": "<unk>",
|
61 |
+
"use_default_system_prompt": true
|
62 |
+
}
|