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abilityai/japanese-stablelm-base-gamma-7b
|
| 7 |
+
- Aratako/Ninja-v1-RP-expressive
|
| 8 |
+
- Aratako/ArrowPro-7B-RobinHood-toxic
|
| 9 |
+
- Elizezen/Phos-7B-RP
|
| 10 |
+
- DataPilot/ArrowPro-7B-KillerWhale
|
| 11 |
+
- umiyuki/Umievo-itr012-Gleipnir-7B
|
| 12 |
+
- DataPilot/ArrowPro-7B-KUJIRA
|
| 13 |
+
library_name: transformers
|
| 14 |
+
tags:
|
| 15 |
+
- mergekit
|
| 16 |
+
- merge
|
| 17 |
+
language:
|
| 18 |
+
- ja
|
| 19 |
+
pipeline_tag: text-generation
|
| 20 |
+
license: apache-2.0
|
| 21 |
+
---
|
| 22 |
+
# RP-7b-instruct
|
| 23 |
+
|
| 24 |
+
🚨 **This model is tuning to RP and knowledge is likely unstable.**
|
| 25 |
+
|
| 26 |
+
This is a merge of pre-trained language models created using [mergekit](https://github.com/cg123/mergekit).
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
## Output Example
|
| 30 |
+
|
| 31 |
+
```
|
| 32 |
+
[INST] <<SYS>>
|
| 33 |
+
あなたは日本語を話す優秀なアシスタントです。回答には必ず日本語で答えてください。また考える過程も出力してください。
|
| 34 |
+
<</SYS>>
|
| 35 |
+
|
| 36 |
+
まどマギで一番好きなキャラは? [/INST]まどマギで一番好きなキャラクターは、鹿目まどかです。彼女は物語の中心人物であり、優しくて芯の強い性格が魅力的です。また、彼女が魔法少女としての運命を受け入れ、他の魔法少女たちを救うために奔走する姿には感動します。彼女の最期の選択も、多くの人々の心に残る名シーンとなっています。
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Test environment
|
| 40 |
+
|
| 41 |
+
This model was tested using [text-generation-webui](https://github.com/oobabooga/text-generation-webui/tree/main). I use preset `min_p` and `Null preset` with temperature=0.3 for Generation.
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
## Usage
|
| 45 |
+
|
| 46 |
+
This format must be adhered to strictly, as deviations may result in less optimal outputs from the model.
|
| 47 |
+
|
| 48 |
+
The template used to construct a prompt for the Instruct model is specified as follows:
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
<s>[INST] <<SYS>>\n{SYSTEM_PROMPT}\n<</SYS>>\n\n{USER_MESSAGE_1} [/INST] {BOT_MESSAGE_1}</s>[INST] {USER_MESSAGE_2} [/INST]
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
Please be aware that ``<s>`` and ``</s>`` are special tokens used for the beginning of string (BOS) and end of string (EOS), respectively, while [INST] and [/INST] are considered regular strings.
|
| 56 |
+
|
| 57 |
+
For the "{SYSTEM_PROMPT}" part, We recommend using "あなたは日本語を話す優秀なアシスタントです。回答には必ず日本語で答えてください。また考える過程も出力してください。"
|
| 58 |
+
|
| 59 |
+
For the "{USER_MESSAGE_1}" part, We recommend using {instruction}\n{input}
|
| 60 |
+
|
| 61 |
+
In other words, We recommend the following:
|
| 62 |
+
|
| 63 |
+
```
|
| 64 |
+
<s>[INST] <<SYS>>\nあなたは日本語を話す優秀なアシスタントです。回答には必ず日本語で答えてください。また考える過程も出力してください。\n<</SYS>>\n\n{instruction1}\n{input1} [/INST] {BOT_MESSAGE_1}</s>[INST] {instruction2}\n{input2} [/INST]
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
### Use the instruct model
|
| 68 |
+
|
| 69 |
+
```python
|
| 70 |
+
import torch
|
| 71 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 72 |
+
|
| 73 |
+
model_name = "nitky/RP-7b-instruct"
|
| 74 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
|
| 75 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 76 |
+
|
| 77 |
+
device = "cuda"
|
| 78 |
+
|
| 79 |
+
messages = [
|
| 80 |
+
{"role": "system", "content": "あなたは日本語を話す優秀なアシスタントです。回答には必ず日本語で答えてください。また考える過程も出力してください。"},
|
| 81 |
+
{"role": "user", "content": "まどマギで一番好きなキャラは?"}
|
| 82 |
+
]
|
| 83 |
+
|
| 84 |
+
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
|
| 85 |
+
|
| 86 |
+
model_inputs = encodeds.to(device)
|
| 87 |
+
model.to(device)
|
| 88 |
+
|
| 89 |
+
generated_ids = model.generate(model_inputs, max_new_tokens=256, do_sample=True, temperature=0.3)
|
| 90 |
+
decoded = tokenizer.batch_decode(generated_ids)
|
| 91 |
+
print(decoded[0])
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
## Merge Details
|
| 95 |
+
### Merge Method
|
| 96 |
+
|
| 97 |
+
This model was merged using the [Model Stock](https://arxiv.org/abs/2403.19522) merge method using [stabilityai/japanese-stablelm-base-gamma-7b](https://huggingface.co/stabilityai/japanese-stablelm-base-gamma-7b) as a base.
|
| 98 |
+
|
| 99 |
+
### Models Merged
|
| 100 |
+
|
| 101 |
+
The following models were included in the merge:
|
| 102 |
+
* [DataPilot/ArrowPro-7B-RobinHood](https://huggingface.co/DataPilot/ArrowPro-7B-RobinHood)
|
| 103 |
+
* [Aratako/AntlerStar-RP](https://huggingface.co/Aratako/AntlerStar-RP)
|
| 104 |
+
* [ohwi/japanese-stablelm-instruct-gamma-7b-dpo-uf-v1](https://huggingface.co/ohwi/japanese-stablelm-instruct-gamma-7b-dpo-uf-v1)
|
| 105 |
+
* [Aratako/Ninja-v1-RP-expressive](https://huggingface.co/Aratako/Ninja-v1-RP-expressive)
|
| 106 |
+
* [Aratako/ArrowPro-7B-RobinHood-toxic](https://huggingface.co/Aratako/ArrowPro-7B-RobinHood-toxic)
|
| 107 |
+
* [Elizezen/Phos-7B-RP](https://huggingface.co/Elizezen/Phos-7B-RP)
|
| 108 |
+
* [DataPilot/ArrowPro-7B-KillerWhale](https://huggingface.co/DataPilot/ArrowPro-7B-KillerWhale)
|
| 109 |
+
* [umiyuki/Umievo-itr012-Gleipnir-7B](https://huggingface.co/umiyuki/Umievo-itr012-Gleipnir-7B)
|
| 110 |
+
* [DataPilot/ArrowPro-7B-KUJIRA](https://huggingface.co/DataPilot/ArrowPro-7B-KUJIRA)
|
| 111 |
+
|
| 112 |
+
### Configuration
|
| 113 |
+
|
| 114 |
+
The following YAML configuration was used to produce this model:
|
| 115 |
+
|
| 116 |
+
```yaml
|
| 117 |
+
merge_method: model_stock
|
| 118 |
+
base_model: stabilityai/japanese-stablelm-base-gamma-7b
|
| 119 |
+
models:
|
| 120 |
+
- model: Aratako/AntlerStar-RP
|
| 121 |
+
- model: Aratako/ArrowPro-7B-RobinHood-toxic
|
| 122 |
+
- model: Aratako/Ninja-v1-RP-expressive
|
| 123 |
+
- model: DataPilot/ArrowPro-7B-KUJIRA
|
| 124 |
+
- model: DataPilot/ArrowPro-7B-RobinHood
|
| 125 |
+
- model: DataPilot/ArrowPro-7B-KillerWhale
|
| 126 |
+
- model: Elizezen/Phos-7B-RP
|
| 127 |
+
- model: ohwi/japanese-stablelm-instruct-gamma-7b-dpo-uf-v1
|
| 128 |
+
- model: umiyuki/Umievo-itr012-Gleipnir-7B
|
| 129 |
+
dtype: bfloat16
|
| 130 |
+
tokenizer_source: model:stabilityai/japanese-stablelm-base-gamma-7b
|
| 131 |
+
name: RP-7b-instruct
|
| 132 |
+
```
|
mergekit_config.yml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
merge_method: model_stock
|
| 2 |
+
base_model: stabilityai/japanese-stablelm-base-gamma-7b
|
| 3 |
+
models:
|
| 4 |
+
- model: Aratako/AntlerStar-RP
|
| 5 |
+
- model: Aratako/ArrowPro-7B-RobinHood-toxic
|
| 6 |
+
- model: Aratako/Ninja-v1-RP-expressive
|
| 7 |
+
- model: DataPilot/ArrowPro-7B-KUJIRA
|
| 8 |
+
- model: DataPilot/ArrowPro-7B-RobinHood
|
| 9 |
+
- model: DataPilot/ArrowPro-7B-KillerWhale
|
| 10 |
+
- model: Elizezen/Phos-7B-RP
|
| 11 |
+
- model: ohwi/japanese-stablelm-instruct-gamma-7b-dpo-uf-v1
|
| 12 |
+
- model: umiyuki/Umievo-itr012-Gleipnir-7B
|
| 13 |
+
dtype: bfloat16
|
| 14 |
+
tokenizer_source: model:stabilityai/japanese-stablelm-base-gamma-7b
|
| 15 |
+
name: RP-7b-instruct
|