update
Browse files- README.md +103 -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,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-instruction-gptq`
|
15 |
+
|
16 |
+
![rinna-icon](./rinna.png)
|
17 |
+
|
18 |
+
# Overview
|
19 |
+
`rinna/youri-7b-instruction-gptq` is the quantized model for [`rinna/youri-7b-instruction`](https://huggingface.co/rinna/youri-7b-instruction) 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-instruction) for architecture details.
|
24 |
+
|
25 |
+
* **Fine-tuning**
|
26 |
+
|
27 |
+
Refer to the [original model](https://huggingface.co/rinna/youri-7b-instruction) 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-instruction-gptq")
|
53 |
+
model = AutoGPTQForCausalLM.from_quantized("rinna/youri-7b-instruction-gptq", use_safetensors=True)
|
54 |
+
|
55 |
+
instruction = "次の日本語を英語に翻訳してください。"
|
56 |
+
input = "大規模言語モデル(だいきぼげんごモデル、英: large language model、LLM)は、多数のパラメータ(数千万から数十億)を持つ人工ニューラルネットワークで構成されるコンピュータ言語モデルで、膨大なラベルなしテキストを使用して自己教師あり学習または半教師あり学習によって訓練が行われる。"
|
57 |
+
prompt = f"""
|
58 |
+
以下は、タスクを説明する指示と、文脈のある入力の組み合わせです。要求を適切に満たす応答を書きなさい。
|
59 |
+
|
60 |
+
### 指示:
|
61 |
+
{instruction}
|
62 |
+
|
63 |
+
### 入力:
|
64 |
+
{input}
|
65 |
+
|
66 |
+
### 応答:
|
67 |
+
"""
|
68 |
+
token_ids = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
|
69 |
+
|
70 |
+
with torch.no_grad():
|
71 |
+
output_ids = model.generate(
|
72 |
+
input_ids=token_ids.to(model.device),
|
73 |
+
max_new_tokens=200,
|
74 |
+
do_sample=True,
|
75 |
+
temperature=0.5,
|
76 |
+
pad_token_id=tokenizer.pad_token_id,
|
77 |
+
bos_token_id=tokenizer.bos_token_id,
|
78 |
+
eos_token_id=tokenizer.eos_token_id
|
79 |
+
)
|
80 |
+
|
81 |
+
output = tokenizer.decode(output_ids.tolist()[0])
|
82 |
+
print(output)
|
83 |
+
~~~~
|
84 |
+
|
85 |
+
---
|
86 |
+
|
87 |
+
# Tokenization
|
88 |
+
The model uses the original llama-2 tokenizer.
|
89 |
+
|
90 |
+
---
|
91 |
+
|
92 |
+
# How to cite
|
93 |
+
~~~
|
94 |
+
@misc{RinnaYouri7bInstructionGPTQ,
|
95 |
+
url={https://huggingface.co/rinna/youri-7b-instruction-gptq},
|
96 |
+
title={rinna/youri-7b-instruction-gptq},
|
97 |
+
author={Wakatsuki, Toshiaki and Zhao, Tianyu and Sawada, Kei}
|
98 |
+
}
|
99 |
+
~~~
|
100 |
+
---
|
101 |
+
|
102 |
+
# License
|
103 |
+
[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:c2b8bc4a1bce022b1a516a78db6405cff8642c20e177554d127ac20a216f5ad6
|
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 |
+
}
|