初始化项目,由ModelHub XC社区提供模型
Model: abeja/ABEJA-QwQ32b-Reasoning-Japanese-v1.0 Source: Original Platform
This commit is contained in:
97
README.md
Normal file
97
README.md
Normal file
@@ -0,0 +1,97 @@
|
||||
---
|
||||
library_name: transformers
|
||||
license: apache-2.0
|
||||
language:
|
||||
- ja
|
||||
base_model:
|
||||
- Qwen/Qwen2.5-32B-Instruct
|
||||
- abeja/ABEJA-Qwen2.5-32b-Japanese-v0.1
|
||||
- Qwen/QwQ-32B
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
## ABEJA-QwQ32b-Reasoning-Japanese-v1.0
|
||||
|
||||
ABEJA-QwQ32b-Reasoning-Japanese-v1.0はabeja/ABEJA-Qwen2.5-32b-Japanese-v0.1(*)をベースとしたReasoningモデルです。
|
||||
|
||||
ABEJA-Qwen2.5-32b-Japanese-v0.1に対してQwen/QwQ-32BのChatVectorをマージしたあと、追加学習をすることでReasoningモデルとして日本語性能を確保しています。
|
||||
|
||||
(*)Qwen/Qwen2.5-32B-Instructをベースに日本語中心とした継続事前学習を実施したモデル
|
||||
|
||||
|
||||
`<think></think>`で囲まれた思考過程の後に最終的な出力をします。
|
||||
|
||||
|
||||
## 使用上の注意
|
||||
|
||||
モデルマージで利用している [QwQ-32B](https://huggingface.co/Qwen/QwQ-32B) の特性を引き継いでおり、QwQ-32BのUsage-Gidelineに従った利用を推奨します。
|
||||
|
||||
https://huggingface.co/Qwen/QwQ-32B#usage-guidelines
|
||||
|
||||
特に
|
||||
|
||||
- 強制的に思考過程を経るために `<think>\n` の後から出力を開始してください。apply_chat_templateを使いadd_generation_prompt=Trueとすると、自動的に適用されます。
|
||||
- Temperature=0.6, TopP=0.95, MinP=0, TopKを20から40の間、といったパラメータを推奨します。(ここの値を大きく変えると精度が落ちることを確認しています)
|
||||
- multi-turnでの会話では、会話履歴の中には最終的な出力のみで`<think></think>`で囲まれた思考過程は含めないでください。この機能もすでにapply_chat_templateに含んでいます。
|
||||
- Systemプロンプトは不要です。最初にrole:userから始めてください。
|
||||
|
||||
といった点はご注意ください。
|
||||
|
||||
## 使い方
|
||||
|
||||
```Python
|
||||
import torch
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
|
||||
model_name = "abeja/ABEJA-QwQ32b-Reasoning-Japanese-v1.0"
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
model_name,
|
||||
torch_dtype="auto",
|
||||
device_map="auto"
|
||||
)
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
||||
|
||||
prompt = "人とAIが協調するためには?"
|
||||
messages = [
|
||||
{"role": "user", "content": prompt}
|
||||
]
|
||||
text = tokenizer.apply_chat_template(
|
||||
messages,
|
||||
tokenize=False,
|
||||
add_generation_prompt=True
|
||||
)
|
||||
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
||||
|
||||
generated_ids = model.generate(
|
||||
**model_inputs,
|
||||
max_new_tokens=32768
|
||||
)
|
||||
generated_ids = model.generate(
|
||||
**model_inputs,
|
||||
max_new_tokens=32768,
|
||||
do_sample=True,
|
||||
temperature=0.6,
|
||||
top_k=40,
|
||||
top_p=0.95,
|
||||
)
|
||||
generated_ids = [
|
||||
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
||||
]
|
||||
|
||||
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
||||
|
||||
print(response)
|
||||
```
|
||||
|
||||
## 開発者
|
||||
|
||||
- Hiroshi Kiyota
|
||||
- Keisuke Fujimoto
|
||||
- Kentaro Nakanishi
|
||||
- Kyo Hattori
|
||||
- Shinya Otani
|
||||
- Shogo Muranushi
|
||||
- Takuma Kume
|
||||
- Tomoki Manabe
|
||||
|
||||
(*)アルファベット順
|
||||
Reference in New Issue
Block a user