Text Generation
Transformers
PyTorch
Safetensors
Japanese
English
llama
text-generation-inference
tianyuz commited on
Commit
d379387
1 Parent(s): baf5b76
README.md ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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`
15
+
16
+ ![rinna-icon](./rinna.png)
17
+
18
+ # Overview
19
+ The model is the instruction-tuned version of [`rinna/youri-7b`](https://huggingface.co/rinna/youri-7b). It adopts the Alpaca input format.
20
+
21
+ * **Model architecture**
22
+
23
+ A 32-layer, 4096-hidden-size transformer-based language model. Refer to the [llama2 paper](https://arxiv.org/abs/2307.09288) for architecture details.
24
+
25
+ * **Fine-tuning**
26
+
27
+ The fine-tuning data is the subset of the following datasets.
28
+ * [Databricks Dolly data](https://huggingface.co/datasets/databricks/databricks-dolly-15k)
29
+ * [Japanese Databricks Dolly data](https://huggingface.co/datasets/kunishou/databricks-dolly-15k-ja)
30
+ * [FLAN Instruction Tuning data](https://github.com/google-research/FLAN) and its Japanese translation
31
+ * [Izumi lab LLM Japanese dataset](https://github.com/masanorihirano/llm-japanese-dataset/tree/main)
32
+ * The following sections are used
33
+ * alt
34
+ * aozora-txt
35
+ * CourseraParallel
36
+ * ParaNatCom
37
+ * Tab-delimited_Bilingual_Sentence_Pairs
38
+ * tanaka-corpus
39
+ * wikinews
40
+ * wordnet
41
+ * yasashi-japanese
42
+ * The [remaining sections](https://github.com/masanorihirano/llm-japanese-dataset/tree/main/datasets-cc-by-sa) contain commonly used evaluation corpora so they are skipped to prevent data leak.
43
+
44
+ * **Authors**
45
+
46
+ - [Tianyu Zhao](https://huggingface.co/tianyuz)
47
+ - [Kei Sawada](https://huggingface.co/keisawada)
48
+
49
+ ---
50
+
51
+ # Benchmarking
52
+
53
+ Evaluation experiments suggest that rinna's `youri-7b` series outperforms other open-source Japanese LLMs on Japanese tasks according to our runs.
54
+
55
+ | Model | Model type | 4-task score | 6-task score | 8-task score |
56
+ | :-- | :-- | :-- | :-- | :-- |
57
+ | **rinna/youri-7b-instruction** | **SFT** | **83.88** | **80.93** | **63.63** |
58
+ | rinna/youri-7b-chat | SFT | 78.29 | 78.47 | 62.18 |
59
+ | matsuo-lab/weblab-10b-instruction-sft | SFT | 78.75 | 75.05 | 59.11 |
60
+ | rinna/youri-7b | pre-trained | 73.32 | 74.58 | 58.87 |
61
+ | stabilityai/japanese-stablelm-instruct-alpha-7b | SFT | 70.10 | 71.32 | 54.71 |
62
+ | elyza/ELYZA-japanese-Llama-2-7b | pre-trained | 71.72 | 69.28 | 53.17 |
63
+ | elyza/ELYZA-japanese-Llama-2-7b-instruct | SFT | 70.57 | 68.12 | 53.14 |
64
+ | stabilityai/japanese-stablelm-base-alpha-7b | pre-trained | 61.03 | 65.83 | 51.05 |
65
+ | matsuo-lab/weblab-10b | pre-trained | 66.33 | 65.58 | 50.74 |
66
+ | meta/llama2-7b | pre-trained | 56.33 | 54.80 | 42.97 |
67
+ | rinna/japanese-gpt-neox-3.6b | pre-trained | 47.20 | 54.68 | 41.80 |
68
+ | rinna/bilingual-gpt-neox-4b | pre-trained | 46.60 | 52.04 | 40.03 |
69
+
70
+ ---
71
+
72
+ # How to use the model
73
+
74
+ ~~~~python
75
+ import torch
76
+ from transformers import AutoTokenizer, AutoModelForCausalLM
77
+
78
+ tokenizer = AutoTokenizer.from_pretrained("rinna/youri-7b-instruction")
79
+ model = AutoModelForCausalLM.from_pretrained("rinna/youri-7b-instruction")
80
+
81
+ if torch.cuda.is_available():
82
+ model = model.to("cuda")
83
+
84
+ instruction = "次の日本語を英語に翻訳してください。"
85
+ input = "大規模言語モデル(だいきぼげんごモデル、英: large language model、LLM)は、多数のパラメータ(数千万から数十億)を持つ人工ニューラルネットワークで構成されるコンピュータ言語モデルで、膨大なラベルなしテキストを使用して自己教師あり学習または半教師あり学習によって訓練が行われる。"
86
+ prompt = f"""
87
+ 以下は、タスクを説明する指示と、文脈のある入力の組み合わせです。要求を適切に満たす応答を書きなさい。
88
+
89
+ ### 指示:
90
+ {instruction}
91
+
92
+ ### 入力:
93
+ {input}
94
+
95
+ ### 応答:
96
+ """
97
+ token_ids = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
98
+
99
+ with torch.no_grad():
100
+ output_ids = model.generate(
101
+ token_ids.to(model.device),
102
+ max_new_tokens=200,
103
+ do_sample=True,
104
+ temperature=0.5,
105
+ pad_token_id=tokenizer.pad_token_id,
106
+ bos_token_id=tokenizer.bos_token_id,
107
+ eos_token_id=tokenizer.eos_token_id
108
+ )
109
+
110
+ output = tokenizer.decode(output_ids.tolist()[0])
111
+ print(output)
112
+ """
113
+ 以下は、タスクを説明する指示と、文脈のある入力の組み合わせです。要求を適切に満たす応答を書きなさい。
114
+
115
+ ### 指示:
116
+ 次の日本語を英語に翻訳してください。
117
+
118
+ ### 入力:
119
+ 大規模言語モデル(だいきぼげんごモデル、英: large language model、LLM)は、多数のパラメータ(数千万から数十億)を持つ人工ニューラルネットワークで構成されるコンピュータ言語モデルで、膨大なラベルなしテキストを使 用して自己教師あり学習または半教師あり学習によって訓練が行わ���る。
120
+
121
+ ### 応答:
122
+ Large language models (LLMs) are computer language models that are composed of artificial neural networks with millions to billions of parameters that are trained via self-supervised or semi-supervised learning using vast unlabeled text.</s>
123
+ """
124
+ ~~~~
125
+
126
+ ---
127
+
128
+ # Tokenization
129
+ The model uses the original llama-2 tokenizer.
130
+
131
+ ---
132
+
133
+ # How to cite
134
+ ~~~
135
+ @misc{RinnaYouri7bInstruction,,
136
+ url={https://huggingface.co/rinna/youri-7b-instruction},
137
+ title={rinna/youri-7b-instruction},
138
+ author={Zhao, Tianyu and Sawada, Kei}
139
+ }
140
+ ~~~
141
+ ---
142
+
143
+ # License
144
+ [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": "bfloat16",
24
+ "transformers_version": "4.34.0",
25
+ "use_cache": true,
26
+ "vocab_size": 32000
27
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "4.34.0"
7
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:04fe7e03e59d03717adf77a5cc88f8d90cb16a43ea1fcdd39de133cbc995ccce
3
+ size 13476871854
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_checklist.chk ADDED
@@ -0,0 +1 @@
 
 
1
+ eeec4125e9c7560836b4873b6f8e3025 tokenizer.model
tokenizer_config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "bos_token": {
5
+ "__type": "AddedToken",
6
+ "content": "<s>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "clean_up_tokenization_spaces": false,
13
+ "eos_token": {
14
+ "__type": "AddedToken",
15
+ "content": "</s>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ },
21
+ "legacy": false,
22
+ "model_max_length": 1000000000000000019884624838656,
23
+ "pad_token": null,
24
+ "padding_side": "right",
25
+ "sp_model_kwargs": {},
26
+ "tokenizer_class": "LlamaTokenizer",
27
+ "unk_token": {
28
+ "__type": "AddedToken",
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false
34
+ }
35
+ }