update
Browse files- README.md +152 -0
- config.json +27 -0
- gptq_model-4bit-128g.safetensors +3 -0
- quantize_config.json +11 -0
- rinna.png +0 -0
- special_tokens_map.json +23 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +39 -0
README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
thumbnail: https://github.com/rinnakk/japanese-pretrained-models/blob/master/rinna.png
|
| 3 |
+
license: llama2
|
| 4 |
+
language:
|
| 5 |
+
- ja
|
| 6 |
+
- en
|
| 7 |
+
inference: false
|
| 8 |
+
datasets:
|
| 9 |
+
- databricks/databricks-dolly-15k
|
| 10 |
+
- kunishou/databricks-dolly-15k-ja
|
| 11 |
+
- izumi-lab/llm-japanese-dataset
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# `rinna/youri-7b-chat-gptq`
|
| 15 |
+
|
| 16 |
+

|
| 17 |
+
|
| 18 |
+
# Overview
|
| 19 |
+
`rinna/youri-7b-chat-gptq` is the quantized model for [`rinna/youri-7b-chat`](https://huggingface.co/rinna/youri-7b-chat) using AutoGPTQ. The quantized version is 4x smaller than the original model and thus requires less memory and provides faster inference.
|
| 20 |
+
|
| 21 |
+
* **Model architecture**
|
| 22 |
+
|
| 23 |
+
Refer to the [original model](https://huggingface.co/rinna/youri-7b-chat) for architecture details.
|
| 24 |
+
|
| 25 |
+
* **Fine-tuning**
|
| 26 |
+
|
| 27 |
+
Refer to the [original model](https://huggingface.co/rinna/youri-7b-chat) for fine-tuning details.
|
| 28 |
+
|
| 29 |
+
* **Authors**
|
| 30 |
+
|
| 31 |
+
- [Toshiaki Wakatsuki](https://huggingface.co/t-w)
|
| 32 |
+
- [Tianyu Zhao](https://huggingface.co/tianyuz)
|
| 33 |
+
- [Kei Sawada](https://huggingface.co/keisawada)
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
# Benchmarking
|
| 38 |
+
|
| 39 |
+
Our evaluation experiments show that the quantization yields slight performance degradation on downstream tasks.
|
| 40 |
+
|
| 41 |
+
Results will be updated soon.
|
| 42 |
+
|
| 43 |
+
---
|
| 44 |
+
|
| 45 |
+
# How to use the model
|
| 46 |
+
|
| 47 |
+
~~~~python
|
| 48 |
+
import torch
|
| 49 |
+
from transformers import AutoTokenizer
|
| 50 |
+
from auto_gptq import AutoGPTQForCausalLM
|
| 51 |
+
|
| 52 |
+
tokenizer = AutoTokenizer.from_pretrained("rinna/youri-7b-chat-gptq")
|
| 53 |
+
model = AutoGPTQForCausalLM.from_quantized("rinna/youri-7b-chat-gptq", use_safetensors=True)
|
| 54 |
+
|
| 55 |
+
instruction = "次の日本語を英語に翻訳してください。"
|
| 56 |
+
input = "自然言語による指示に基づきタスクが解けるよう学習させることを Instruction tuning と呼びます。"
|
| 57 |
+
|
| 58 |
+
context = [
|
| 59 |
+
{
|
| 60 |
+
"speaker": "設定",
|
| 61 |
+
"text": instruction
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"speaker": "ユーザー",
|
| 65 |
+
"text": input
|
| 66 |
+
}
|
| 67 |
+
]
|
| 68 |
+
prompt = [
|
| 69 |
+
f"{uttr['speaker']}: {uttr['text']}"
|
| 70 |
+
for uttr in context
|
| 71 |
+
]
|
| 72 |
+
prompt = "\n".join(prompt)
|
| 73 |
+
prompt = (
|
| 74 |
+
prompt
|
| 75 |
+
+ "\n"
|
| 76 |
+
+ "システム: "
|
| 77 |
+
)
|
| 78 |
+
token_ids = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
|
| 79 |
+
|
| 80 |
+
with torch.no_grad():
|
| 81 |
+
output_ids = model.generate(
|
| 82 |
+
input_ids=token_ids.to(model.device),
|
| 83 |
+
max_new_tokens=200,
|
| 84 |
+
do_sample=True,
|
| 85 |
+
temperature=0.5,
|
| 86 |
+
pad_token_id=tokenizer.pad_token_id,
|
| 87 |
+
bos_token_id=tokenizer.bos_token_id,
|
| 88 |
+
eos_token_id=tokenizer.eos_token_id
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
output = tokenizer.decode(output_ids.tolist()[0])
|
| 92 |
+
print(output)
|
| 93 |
+
|
| 94 |
+
output = output[len(prompt):-len("</s>")].strip()
|
| 95 |
+
input = "大規模言語モデル(だいきぼげんごモデル、英: large language model、LLM)は、多数のパラメータ(数千万から数十億)を持つ人工ニューラルネットワークで構成されるコンピュータ言語モデルで、膨大なラベルなしテキストを使用して自己教師あり学習または半教師あり学習によって訓練が行われる。"
|
| 96 |
+
|
| 97 |
+
context.extend([
|
| 98 |
+
{
|
| 99 |
+
"speaker": "システム",
|
| 100 |
+
"text": output
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"speaker": "ユーザー",
|
| 104 |
+
"text": input
|
| 105 |
+
}
|
| 106 |
+
])
|
| 107 |
+
prompt = [
|
| 108 |
+
f"{uttr['speaker']}: {uttr['text']}"
|
| 109 |
+
for uttr in context
|
| 110 |
+
]
|
| 111 |
+
prompt = "\n".join(prompt)
|
| 112 |
+
prompt = (
|
| 113 |
+
prompt
|
| 114 |
+
+ "\n"
|
| 115 |
+
+ "システム: "
|
| 116 |
+
)
|
| 117 |
+
token_ids = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
|
| 118 |
+
|
| 119 |
+
with torch.no_grad():
|
| 120 |
+
output_ids = model.generate(
|
| 121 |
+
input_ids=token_ids.to(model.device),
|
| 122 |
+
max_new_tokens=200,
|
| 123 |
+
do_sample=True,
|
| 124 |
+
temperature=0.5,
|
| 125 |
+
pad_token_id=tokenizer.pad_token_id,
|
| 126 |
+
bos_token_id=tokenizer.bos_token_id,
|
| 127 |
+
eos_token_id=tokenizer.eos_token_id
|
| 128 |
+
)
|
| 129 |
+
|
| 130 |
+
output = tokenizer.decode(output_ids.tolist()[0])
|
| 131 |
+
print(output)
|
| 132 |
+
~~~~
|
| 133 |
+
|
| 134 |
+
---
|
| 135 |
+
|
| 136 |
+
# Tokenization
|
| 137 |
+
The model uses the original llama-2 tokenizer.
|
| 138 |
+
|
| 139 |
+
---
|
| 140 |
+
|
| 141 |
+
# How to cite
|
| 142 |
+
~~~
|
| 143 |
+
@misc{RinnaYouri7bChatGPTQ,
|
| 144 |
+
url={https://huggingface.co/rinna/youri-7b-chat-gptq},
|
| 145 |
+
title={rinna/youri-7b-chat-gptq},
|
| 146 |
+
author={Wakatsuki, Toshiaki and Zhao, Tianyu and Sawada, Kei}
|
| 147 |
+
}
|
| 148 |
+
~~~
|
| 149 |
+
---
|
| 150 |
+
|
| 151 |
+
# License
|
| 152 |
+
[The llama2 license](https://ai.meta.com/llama/license/)
|
config.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"bos_token_id": 1,
|
| 7 |
+
"eos_token_id": 2,
|
| 8 |
+
"hidden_act": "silu",
|
| 9 |
+
"hidden_size": 4096,
|
| 10 |
+
"initializer_range": 0.02,
|
| 11 |
+
"intermediate_size": 11008,
|
| 12 |
+
"max_position_embeddings": 4096,
|
| 13 |
+
"model_type": "llama",
|
| 14 |
+
"num_attention_heads": 32,
|
| 15 |
+
"num_hidden_layers": 32,
|
| 16 |
+
"num_key_value_heads": 32,
|
| 17 |
+
"pad_token_id": 0,
|
| 18 |
+
"pretraining_tp": 1,
|
| 19 |
+
"rms_norm_eps": 1e-05,
|
| 20 |
+
"rope_scaling": null,
|
| 21 |
+
"rope_theta": 10000.0,
|
| 22 |
+
"tie_word_embeddings": false,
|
| 23 |
+
"torch_dtype": "float16",
|
| 24 |
+
"transformers_version": "4.34.1",
|
| 25 |
+
"use_cache": true,
|
| 26 |
+
"vocab_size": 32000
|
| 27 |
+
}
|
gptq_model-4bit-128g.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d9d8b7a248b087966f619052c5c778c377d71ec02365beb3b127248f50e99d09
|
| 3 |
+
size 3896714728
|
quantize_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bits": 4,
|
| 3 |
+
"group_size": 128,
|
| 4 |
+
"damp_percent": 0.01,
|
| 5 |
+
"desc_act": false,
|
| 6 |
+
"static_groups": false,
|
| 7 |
+
"sym": true,
|
| 8 |
+
"true_sequential": true,
|
| 9 |
+
"model_name_or_path": null,
|
| 10 |
+
"model_file_base_name": null
|
| 11 |
+
}
|
rinna.png
ADDED
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"unk_token": {
|
| 17 |
+
"content": "<unk>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
}
|
| 23 |
+
}
|
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:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
| 3 |
+
size 499723
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "<unk>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "<s>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"2": {
|
| 20 |
+
"content": "</s>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
}
|
| 27 |
+
},
|
| 28 |
+
"bos_token": "<s>",
|
| 29 |
+
"clean_up_tokenization_spaces": false,
|
| 30 |
+
"eos_token": "</s>",
|
| 31 |
+
"legacy": false,
|
| 32 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 33 |
+
"pad_token": null,
|
| 34 |
+
"padding_side": "right",
|
| 35 |
+
"sp_model_kwargs": {},
|
| 36 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 37 |
+
"unk_token": "<unk>",
|
| 38 |
+
"use_default_system_prompt": true
|
| 39 |
+
}
|