Improve language tag
Browse filesHi! As the model is multilingual, this is a PR to add other languages than English to the language tag to improve the referencing. Note that 29 languages are announced in the README, but only 13 are explicitly listed. I was therefore only able to add these 13 languages.
README.md
CHANGED
@@ -1,238 +1,250 @@
|
|
1 |
-
---
|
2 |
-
library_name: transformers
|
3 |
-
tags:
|
4 |
-
- DPO
|
5 |
-
license: apache-2.0
|
6 |
-
datasets:
|
7 |
-
- lightblue/response-dataset-plus-qwen-judged
|
8 |
-
language:
|
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 |
-
This
|
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 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
""
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
#
|
177 |
-
# --------------------------------
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
-
|
210 |
-
-
|
211 |
-
|
212 |
-
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
tags:
|
4 |
+
- DPO
|
5 |
+
license: apache-2.0
|
6 |
+
datasets:
|
7 |
+
- lightblue/response-dataset-plus-qwen-judged
|
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 |
+
base_model:
|
23 |
+
- Qwen/Qwen2.5-7B-Instruct
|
24 |
+
---
|
25 |
+
|
26 |
+
[日本語モデルカード/Japanese model card](#japanese)
|
27 |
+
|
28 |
+
[日本語のブログ/Full Japanese dev blog](https://note.com/lightblue_tech/n/n6967ff462f4a?sub_rt=share_pb)
|
29 |
+
|
30 |
+
[Development source code/開発ソースコード](https://github.com/lightblue-tech/karasu_dpo_202501)
|
31 |
+
|
32 |
+
# Karasu-DPO-7B
|
33 |
+
|
34 |
+
This is a Japanese version of the [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) model which was DPO trained using synthetic Japanese conversation data.
|
35 |
+
|
36 |
+
This model outperforms the base [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) model on the [arena-hard-auto-multilingual](https://github.com/lightblue-tech/arena-hard-auto-multilingual) chat benchmark:
|
37 |
+
|
38 |
+
|Qwen2.5-7B-Instruct|Karasu-DPO-7B|
|
39 |
+
|----|----|
|
40 |
+
|50.0|66.2|
|
41 |
+
|
42 |
+
We recommend this model for use as a general conversation AI.
|
43 |
+
|
44 |
+
# How to use
|
45 |
+
|
46 |
+
This model can be used in the same way as any Qwen 2.5 model. We recommend using vLLM for simplicity and speed.
|
47 |
+
|
48 |
+
<ul>
|
49 |
+
<li><b>vLLM</b>
|
50 |
+
|
51 |
+
Install [vLLM](https://github.com/vllm-project/vllm/) using `pip install vllm`.
|
52 |
+
|
53 |
+
<details open>
|
54 |
+
<summary>Show vLLM code</summary>
|
55 |
+
|
56 |
+
```python
|
57 |
+
from vllm import LLM, SamplingParams
|
58 |
+
|
59 |
+
llm = LLM(
|
60 |
+
model="lightblue/DeepSeek-R1-Distill-Qwen-7B-Japanese",
|
61 |
+
max_model_len=8_000
|
62 |
+
)
|
63 |
+
|
64 |
+
sampling_params = SamplingParams(
|
65 |
+
temperature=0.0,
|
66 |
+
max_tokens=8_000,
|
67 |
+
)
|
68 |
+
|
69 |
+
prompts = [
|
70 |
+
"""ナイジェリアの首都はどこですか?""",
|
71 |
+
"""鉄は何度に溶けますか?""",
|
72 |
+
"""父が好きそうなプレゼントのおすすめを教えて""",
|
73 |
+
]
|
74 |
+
|
75 |
+
conversations = [
|
76 |
+
[{"role": "user", "content": x}] for x in prompts
|
77 |
+
]
|
78 |
+
|
79 |
+
outputs = llm.chat(conversations, sampling_params=sampling_params)
|
80 |
+
|
81 |
+
for output in outputs:
|
82 |
+
print(output.outputs[0].text)
|
83 |
+
print("-"*32)
|
84 |
+
|
85 |
+
# ナイジェリアの首都はアブジャ(Abuja)です。以前はラゴスが首都でしたが、1991年に新しい首都としてアブジャが建設され、1991年12月12日に首都としての地位を正式に取得しました。アブジャは政治中心地として機能していますが、経済の中心地は依然としてラゴスが占めています。
|
86 |
+
# --------------------------------
|
87 |
+
# 鉄は非常に高い温度で溶けます。鉄の融点は約1,538℃(2,800°F)です。これは、一般的な家庭用のオーブン(最大約200-300℃)では絶対に達成できません。鉄を溶かすためには、より高温の設備が必要で、例えば、電気炉やガス炉などがあります。
|
88 |
+
# --------------------------------
|
89 |
+
# もちろんです。父さんへのプレゼント選びは楽しみですね。以下に、父が喜ぶ2つのプレゼントを提案します:
|
90 |
+
|
91 |
+
# 1. **高級コーヒーメーカー**:
|
92 |
+
# - 父さんがコーヒーを愛飲しているなら、高品質なコーヒーメーカーは大変喜ばれるプレゼントです。例えば、手動式のコーヒーメーカーなら、毎日のコーヒー作りがより楽しく、手作り感も楽しめます。また、自動式のコーヒーメーカーなら、忙しい朝でも美味しいコーヒーが楽しめます。
|
93 |
+
|
94 |
+
# 2. **趣味に合わせたギフトセット**:
|
95 |
+
# - 父さんの趣味や興味に合わせたギフトセットは、とても喜ばれます。例えば、ゴルフ好きなら、最新のゴルフクラブやゴルフバッグ、ゴルフボールセットなどが良いでしょう。また、車好きなら、高品質な車用アクセサリー(カーフィルム、カーボンシートなど)や車載用の充電器などが喜ばれます。
|
96 |
+
|
97 |
+
# これらのプレゼントは、父さんの趣味や��味に合わせて選べば、きっと喜んでもらえることでしょう。
|
98 |
+
# --------------------------------
|
99 |
+
```
|
100 |
+
|
101 |
+
</details>
|
102 |
+
|
103 |
+
<br/>
|
104 |
+
|
105 |
+
# How this model was made
|
106 |
+
|
107 |
+
We made this model through the following procedure:
|
108 |
+
|
109 |
+
1. Sample Japanese and English prompts from the following datasets:
|
110 |
+
* lmsys/lmsys-chat-1m
|
111 |
+
* RyokoAI/ShareGPT52K
|
112 |
+
* openchat/openchat_sharegpt_v3
|
113 |
+
* OpenAssistant/oasst2
|
114 |
+
* Open-Orca/slimorca-deduped-cleaned-corrected
|
115 |
+
* HuggingFaceH4/ultrachat_200k
|
116 |
+
2. Translate English prompts to Japanese using [gpt-4o-mini](https://openai.com/index/gpt-4o-mini-advancing-cost-efficient-intelligence/).
|
117 |
+
3. Correct translations with [gpt-4o-mini](https://openai.com/index/gpt-4o-mini-advancing-cost-efficient-intelligence/).
|
118 |
+
4. Get responses to all Japanese prompts (both original and translated) with [gpt-4o-mini](https://openai.com/index/gpt-4o-mini-advancing-cost-efficient-intelligence/).
|
119 |
+
5. Correct responses using [gpt-4o-mini](https://openai.com/index/gpt-4o-mini-advancing-cost-efficient-intelligence/).
|
120 |
+
|
121 |
+
We QLoRA DPO trained a [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) model on this data to create Karasu-DPO-7B.
|
122 |
+
|
123 |
+
<h1 style="font-size: 48px;" id="japanese">日本語</h3>
|
124 |
+
|
125 |
+
こちらのモデルは[Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct)の日本語版です。生成した日本語会話データとDPO学習で作成しました。
|
126 |
+
|
127 |
+
このモデルは、[arena-hard-auto-multilingual](https://github.com/lightblue-tech/arena-hard-auto-multilingual)チャットベンチマークにおいて、ベースモデルである[Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct)を上回る性能を発揮します:
|
128 |
+
|
129 |
+
|Qwen2.5-7B-Instruct|Karasu-DPO-7B|
|
130 |
+
|----|----|
|
131 |
+
|50.0|66.2|
|
132 |
+
|
133 |
+
このモデルは、一般的な会話AIとしての使用を推奨します。
|
134 |
+
|
135 |
+
# 使用方法
|
136 |
+
|
137 |
+
このモデルは、他のQwen 2.5モデルと同様の方法で使用できます。シンプルで高速な操作のためにはvLLMの使用を推奨します。
|
138 |
+
|
139 |
+
<ul>
|
140 |
+
<li><b>vLLM</b>
|
141 |
+
|
142 |
+
[vLLM](https://github.com/vllm-project/vllm/)を`pip install vllm`でインストールしてください。
|
143 |
+
|
144 |
+
<details open>
|
145 |
+
<summary>vLLMコードを見る</summary>
|
146 |
+
|
147 |
+
```python
|
148 |
+
from vllm import LLM, SamplingParams
|
149 |
+
|
150 |
+
llm = LLM(
|
151 |
+
model="lightblue/DeepSeek-R1-Distill-Qwen-7B-Japanese",
|
152 |
+
max_model_len=8_000
|
153 |
+
)
|
154 |
+
|
155 |
+
sampling_params = SamplingParams(
|
156 |
+
temperature=0.0,
|
157 |
+
max_tokens=8_000,
|
158 |
+
)
|
159 |
+
|
160 |
+
prompts = [
|
161 |
+
"""ナイジェリアの首都はどこですか?""",
|
162 |
+
"""鉄は何度に溶けますか?""",
|
163 |
+
"""父が好きそうなプレゼントのおすすめを教えて""",
|
164 |
+
]
|
165 |
+
|
166 |
+
conversations = [
|
167 |
+
[{"role": "user", "content": x}] for x in prompts
|
168 |
+
]
|
169 |
+
|
170 |
+
outputs = llm.chat(conversations, sampling_params=sampling_params)
|
171 |
+
|
172 |
+
for output in outputs:
|
173 |
+
print(output.outputs[0].text)
|
174 |
+
print("-"*32)
|
175 |
+
|
176 |
+
# ナイジェリアの首都はアブジャ(Abuja)です。以前はラゴスが首都でしたが、1991年に新しい首都としてアブジャが建設され、1991年12月12日に首都としての地位を正式に取得しました。アブジャは政治中心地として機能していますが、経済の中心地は依然としてラゴスが占めています。
|
177 |
+
# --------------------------------
|
178 |
+
# 鉄は非常に高い温度で溶けます。鉄の融点は約1,538℃(2,800°F)です。これは、一般的な家庭用のオーブン(最大約200-300℃)では絶対に達成できません。鉄を溶かすためには、より高温の設備が必要で、例えば、電気炉やガス炉などがあります。
|
179 |
+
# --------------------------------
|
180 |
+
# もちろんです。父さんへのプレゼント選びは楽しみですね。以下に、父が喜ぶ2つのプレゼントを提案します:
|
181 |
+
|
182 |
+
# 1. **高級コーヒーメーカー**:
|
183 |
+
# - 父さんがコーヒーを愛飲しているなら、高品質なコーヒーメーカーは大変喜ばれるプレゼントです。例えば、手動式のコーヒーメーカーなら、毎日のコーヒー作りがより楽しく、手作り感も楽しめます。また、自動式のコーヒーメーカーなら、忙しい朝でも美味しいコーヒーが楽しめます。
|
184 |
+
|
185 |
+
# 2. **趣味に合わせたギフトセット**:
|
186 |
+
# - 父さんの趣味や興味に合わせたギフトセットは、とても喜ばれます。例えば、ゴルフ好きなら、最新のゴルフクラブやゴルフバッグ、ゴルフボールセットなどが良いでしょう。また、車好きなら、高品質な車用アクセサリー(カーフィルム、カーボンシートなど)や車載用の充電器などが喜ばれます。
|
187 |
+
|
188 |
+
# これらのプレゼントは、父さんの趣味や興味に合わせて選べば、きっと喜んでもらえることでしょう。
|
189 |
+
# --------------------------------
|
190 |
+
```
|
191 |
+
|
192 |
+
</details>
|
193 |
+
|
194 |
+
<br/>
|
195 |
+
|
196 |
+
# このモデルの作成方法
|
197 |
+
|
198 |
+
このモデルは以下の手順を通して作成されました:
|
199 |
+
|
200 |
+
1. 以下のデータセットから日本語および英語のプロンプトをサンプリング:
|
201 |
+
* lmsys/lmsys-chat-1m
|
202 |
+
* RyokoAI/ShareGPT52K
|
203 |
+
* openchat/openchat_sharegpt_v3
|
204 |
+
* OpenAssistant/oasst2
|
205 |
+
* Open-Orca/slimorca-deduped-cleaned-corrected
|
206 |
+
* HuggingFaceH4/ultrachat_200k
|
207 |
+
2. 英語のプロンプトを[gpt-4o-mini](https://openai.com/index/gpt-4o-mini-advancing-cost-efficient-intelligence/)を使って日本語に翻訳。
|
208 |
+
3. [gpt-4o-mini](https://openai.com/index/gpt-4o-mini-advancing-cost-efficient-intelligence/)を使って翻訳を修正。
|
209 |
+
4. 日本語のプロンプト(オリジナルと翻訳の両方)に対する応答を[gpt-4o-mini](https://openai.com/index/gpt-4o-mini-advancing-cost-efficient-intelligence/)で取得。
|
210 |
+
5. [gpt-4o-mini](https://openai.com/index/gpt-4o-mini-advancing-cost-efficient-intelligence/)を使用して応答を修正。
|
211 |
+
|
212 |
+
[Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct)モデルを基に、QLoRA DPOトレーニングを行い、Karasu-DPO-7Bを作成しました。
|
213 |
+
|
214 |
+
### Model Details
|
215 |
+
- Model size: 7B
|
216 |
+
- Context length: 1024
|
217 |
+
- Language: Japanese
|
218 |
+
|
219 |
+
#### Training Procudure
|
220 |
+
- learning_rate: 5e-6
|
221 |
+
- train_batch_size: 4
|
222 |
+
- eval_batch_size: 2
|
223 |
+
- gradient_accumulation_steps: 4
|
224 |
+
- lr_scheduler_type: cosine
|
225 |
+
|
226 |
+
#### Training Results
|
227 |
+
|**Step**|**Traning Loss**|**Validation Loss**|
|
228 |
+
|----|----|----|
|
229 |
+
|10|0.678400| 0.665870|
|
230 |
+
|20|0.608500| 0.638361|
|
231 |
+
|30|0.577300| 0.607468|
|
232 |
+
|40|0.526700| 0.559432|
|
233 |
+
|50|0.489200| 0.523419|
|
234 |
+
|60|0.502800| 0.511645|
|
235 |
+
|70|0.462300| 0.506989|
|
236 |
+
|80|0.419600| 0.509142|
|
237 |
+
|90|0.445200| 0.510396|
|
238 |
+
|100|0.424400| 0.511653|
|
239 |
+
|
240 |
+
# License
|
241 |
+
|
242 |
+
We share this model under an Apache 2.0 license.
|
243 |
+
|
244 |
+
# Developed by
|
245 |
+
|
246 |
+
<a href="https://www.lightblue-tech.com">
|
247 |
+
<img src="https://www.lightblue-tech.com/wp-content/uploads/2023/08/color_%E6%A8%AA%E5%9E%8B-1536x469.png" alt="Lightblue technology logo" width="400"/>
|
248 |
+
</a>
|
249 |
+
|
250 |
+
This model was trained by Jun Sashihara ([junsashihara](https://huggingface.co/junsashihara)) and supervised by Peter Devine ([ptrdvn](https://huggingface.co/ptrdvn)) for Lightblue。
|