File size: 4,539 Bytes
58e5143
 
 
3fd5cff
 
58e5143
 
 
 
 
 
3fd5cff
 
 
 
 
 
 
 
 
 
 
58e5143
 
3fd5cff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58e5143
 
 
3fd5cff
58e5143
 
 
 
3fd5cff
1
2
3
4
5
6
7
8
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
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
---
base_model: cyberagent/calm3-22b-chat
language:
- ja
license: cc-by-nc-sa-4.0
tags:
- text-generation-inference
- transformers
- unsloth
- llama
- trl
datasets:
- Aratako/Synthetic-Japanese-Roleplay-NSFW-Claude-3.5s-10.5k-formatted
- Aratako/Synthetic-Japanese-Roleplay-gpt-4o-mini-19.8k-formatted
- Aratako/Rosebleu-1on1-Dialogues-RP
- SicariusSicariiStuff/Bluemoon_Top50MB_Sorted_Fixed
- grimulkan/LimaRP-augmented
- MinervaAI/Aesir-Preview
- openerotica/freedom-rp
- openerotica/lima-nsfw
- Chaser-cz/roleplay_scripts
- roleplay4fun/aesir-v1.1
---

# calm3-22b-RP-v0.1
[cyberagent/calm3-22b-chat](https://huggingface.co/cyberagent/calm3-22b-chat)をベースにロールプレイ用にQLoRAでファインチューニングしたモデルです。

[Aratako/calm3-22b-RP](https://huggingface.co/Aratako/calm3-22b-RP)の素材となるモデルとして利用しています。

# プロンプトフォーマット
元モデルから変更なく、ChatMLのフォーマットでご利用ください。以下は2ターン目の会話を行う際の形式です。
```
<|im_start|>system
{ロールプレイの指示、世界観・あらすじの説明、キャラの設定など}<|im_end|>
<|im_start|>user
{userの1ターン目の入力}<|im_end|>
<|im_start|>assistant
{assistantの1ターン目の応答}<|im_end|>
<|im_start|>user
{userの2ターン目の入力}<|im_end|>
<|im_start|>assistant
```

また、`tokenizer.apply_chat_template()`を使って自動で成形することも可能です。

```
tokenizer = AutoTokenizer.from_pretrained("Aratako/calm3-22b-RP-v0.1")

messages = [
    {"role": "system", "content": "{ロールプレイの指示、世界観・あらすじの説明、キャラの設定など}"},
    {"role": "user", "content": "{userの1ターン目の入力}"},
    {"role": "assistant", "content": "{assistantの1ターン目の入力}"},
    {"role": "user", "content": "{userの2ターン目の入力}"}
]

prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
```

# 学習データセット
本モデルの学習には以下のデータセットを利用しています。

### 日本語データセット
- [Aratako/Rosebleu-1on1-Dialogues-RP](https://huggingface.co/datasets/Aratako/Rosebleu-1on1-Dialogues-RP)
- [Aratako/Synthetic-Japanese-Roleplay-NSFW-Claude-3.5s-10.5k-formatted](https://huggingface.co/datasets/Aratako/Synthetic-Japanese-Roleplay-NSFW-Claude-3.5s-10.5k-formatted)
- [Aratako/Synthetic-Japanese-Roleplay-gpt-4o-mini-19.8k-formatted](https://huggingface.co/datasets/Aratako/Synthetic-Japanese-Roleplay-gpt-4o-mini-19.8k-formatted)
### 英語データセット
- [grimulkan/LimaRP-augmented](https://huggingface.co/datasets/grimulkan/LimaRP-augmented)
- [SicariusSicariiStuff/Bluemoon_Top50MB_Sorted_Fixed](https://huggingface.co/datasets/SicariusSicariiStuff/Bluemoon_Top50MB_Sorted_Fixed)
- [MinervaAI/Aesir-Preview](https://huggingface.co/datasets/MinervaAI/Aesir-Preview)
- [openerotica/freedom-rp](https://huggingface.co/datasets/openerotica/freedom-rp)
- [openerotica/lima-nsfw](https://huggingface.co/datasets/openerotica/lima-nsfw)
- [Chaser-cz/roleplay_scripts](https://huggingface.co/datasets/Chaser-cz/roleplay_scripts)
- [roleplay4fun/aesir-v1.1](https://huggingface.co/datasets/roleplay4fun/aesir-v1.1)

## 学習の設定
UnslothのQLoRAを用い、Runpod上のA10一枚で学習を行いました。主な学習パラメータは以下の通りです。
- lora_r: 128
- lisa_alpha: 256
- lora_dropout: 0
- lora_target_modules: ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]
- learning_rate: 5e-5
- num_train_epochs: 1
- batch_size: 64
- max_seq_length: 8192
- weight_decay: 0.01
- warmup_ratio: 0.05

# ライセンス
本モデルの学習データにはOpenAI社のGPT-4o-miniの出力やAnthropic社のClaude 3.5 Sonnetの出力が含まれるため、これらの競合となるサービスには本モデルは利用できません。
そのため、本モデルは[CC-BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.ja)の元配布します。

# Uploaded  model

- **Developed by:** Aratako
- **License:** cc-by-nc-sa-4.0
- **Finetuned from model :** cyberagent/calm3-22b-chat

This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.

[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)