Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
- ja
|
6 |
+
programming_language:
|
7 |
+
- C
|
8 |
+
- C++
|
9 |
+
- C#
|
10 |
+
- Go
|
11 |
+
- Java
|
12 |
+
- JavaScript
|
13 |
+
- Lua
|
14 |
+
- PHP
|
15 |
+
- Python
|
16 |
+
- Ruby
|
17 |
+
- Rust
|
18 |
+
- Scala
|
19 |
+
- TypeScript
|
20 |
+
pipeline_tag: text-generation
|
21 |
+
library_name: transformers
|
22 |
+
inference: false
|
23 |
+
---
|
24 |
+
# llm-jp-3-1.8b-instruct3
|
25 |
+
|
26 |
+
LLM-jp-3 is the series of large language models developed by the [Research and Development Center for Large Language Models](https://llmc.nii.ac.jp/) at the [National Institute of Informatics](https://www.nii.ac.jp/en/).
|
27 |
+
|
28 |
+
This repository provides **llm-jp-3-1.8b-instruct3** model.
|
29 |
+
For an overview of the LLM-jp-3 models across different parameter sizes, please refer to:
|
30 |
+
- [LLM-jp-3 Pre-trained Models](https://huggingface.co/collections/llm-jp/llm-jp-3-pre-trained-models-672c6096472b65839d76a1fa)
|
31 |
+
- [LLM-jp-3 Fine-tuned Models](https://huggingface.co/collections/llm-jp/llm-jp-3-fine-tuned-models-672c621db852a01eae939731).
|
32 |
+
|
33 |
+
|
34 |
+
Checkpoints format: Hugging Face Transformers
|
35 |
+
|
36 |
+
|
37 |
+
## Required Libraries and Their Versions
|
38 |
+
|
39 |
+
- torch>=2.3.0
|
40 |
+
- transformers>=4.40.1
|
41 |
+
- tokenizers>=0.19.1
|
42 |
+
- accelerate>=0.29.3
|
43 |
+
- flash-attn>=2.5.8
|
44 |
+
|
45 |
+
## Usage
|
46 |
+
|
47 |
+
```python
|
48 |
+
import torch
|
49 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
50 |
+
tokenizer = AutoTokenizer.from_pretrained("llm-jp/llm-jp-3-1.8b-instruct3")
|
51 |
+
model = AutoModelForCausalLM.from_pretrained("llm-jp/llm-jp-3-1.8b-instruct3", device_map="auto", torch_dtype=torch.bfloat16)
|
52 |
+
chat = [
|
53 |
+
{"role": "system", "content": "以下は、タスクを説明する指示です。要求を適切に満たす応答を書きなさい。"},
|
54 |
+
{"role": "user", "content": "自然言語処理とは何か"},
|
55 |
+
]
|
56 |
+
tokenized_input = tokenizer.apply_chat_template(chat, add_generation_prompt=True, tokenize=True, return_tensors="pt").to(model.device)
|
57 |
+
with torch.no_grad():
|
58 |
+
output = model.generate(
|
59 |
+
tokenized_input,
|
60 |
+
max_new_tokens=100,
|
61 |
+
do_sample=True,
|
62 |
+
top_p=0.95,
|
63 |
+
temperature=0.7,
|
64 |
+
repetition_penalty=1.05,
|
65 |
+
)[0]
|
66 |
+
print(tokenizer.decode(output))
|
67 |
+
```
|
68 |
+
|
69 |
+
|
70 |
+
## Model Details
|
71 |
+
|
72 |
+
- **Model type:** Transformer-based Language Model
|
73 |
+
- **Total seen tokens:** 2.1T tokens
|
74 |
+
|
75 |
+
|Params|Layers|Hidden size|Heads|Context length|Embedding parameters|Non-embedding parameters|
|
76 |
+
|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
77 |
+
|150M|12|512|8|4096|101,874,688|50,344,448|
|
78 |
+
|440M|16|1024|8|4096|203,749,376|243,303,424|
|
79 |
+
|980M|20|1536|8|4096|305,624,064|684,258,816|
|
80 |
+
|1.8b|24|2048|16|4096|407,498,752|1,459,718,144|
|
81 |
+
|3.7b|28|3072|24|4096|611,248,128|3,171,068,928|
|
82 |
+
|7.2b|32|4096|32|4096|814,997,504|6,476,271,616|
|
83 |
+
|13b|40|5120|40|4096|1,018,746,880|12,688,184,320|
|
84 |
+
|172b|96|12288|96|4096|2,444,992,512|169,947,181,056|
|
85 |
+
|
86 |
+
## Tokenizer
|
87 |
+
|
88 |
+
The tokenizer of this model is based on [huggingface/tokenizers](https://github.com/huggingface/tokenizers) Unigram byte-fallback model.
|
89 |
+
The vocabulary entries were converted from [`llm-jp-tokenizer v3.0`](https://github.com/llm-jp/llm-jp-tokenizer/releases/tag/v3.0b2).
|
90 |
+
Please refer to [README.md](https://github.com/llm-jp/llm-jp-tokenizer) of `llm-jp-tokenizer` for details on the vocabulary construction procedure (the pure SentencePiece training does not reproduce our vocabulary).
|
91 |
+
|
92 |
+
## Datasets
|
93 |
+
|
94 |
+
### Pre-training
|
95 |
+
|
96 |
+
The models have been pre-trained using a blend of the following datasets.
|
97 |
+
|
98 |
+
| Language | Dataset | Tokens|
|
99 |
+
|:---|:---|---:|
|
100 |
+
|Japanese|[Wikipedia](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|2.6B
|
101 |
+
||[Common Crawl](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|762.8B
|
102 |
+
||[WARP/PDF](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|237.3B
|
103 |
+
||[WARP/HTML](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|2.7B
|
104 |
+
||[Kaken](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|1.8B
|
105 |
+
|English|[Wikipedia](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|4.7B
|
106 |
+
||[Dolma/CC-head](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|608.5B
|
107 |
+
||[Dolma/C4](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|181.6B
|
108 |
+
||[Dolma/Reddit](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|83.1B
|
109 |
+
||[Dolma/PeS2o](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|62.9B
|
110 |
+
||[Dolma/Gutenberg](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|5.5B
|
111 |
+
||[Dolma/Wiki](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-corpus-v3)|3.9B
|
112 |
+
|Code|[The Stack](https://huggingface.co/datasets/bigcode/the-stack)|114.1B
|
113 |
+
|Chinese|[Wikipedia](https://huggingface.co/datasets/bigcode/the-stack)|0.8B
|
114 |
+
|Korean|[Wikipedia](https://huggingface.co/datasets/bigcode/the-stack)|0.3B
|
115 |
+
|
116 |
+
### Post-training
|
117 |
+
|
118 |
+
We have fine-tuned the pre-trained checkpoint with supervised fine-tuning and further aligned it with Direct Preference Optimization.
|
119 |
+
|
120 |
+
#### Supervised Fine-tuning
|
121 |
+
The datasets used for supervised fine-tuning are as follows:
|
122 |
+
|
123 |
+
| Language | Dataset | Description |
|
124 |
+
|:---|:---|:---|
|
125 |
+
|Japanese|[ichikara-instruction-004-002](https://liat-aip.sakura.ne.jp/wp/llm%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%a9%e3%82%af%e3%82%b7%e3%83%a7%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf%e4%bd%9c%e6%88%90/llm%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%a9%e3%82%af%e3%82%b7%e3%83%a7%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf-%e5%85%ac%e9%96%8b/)| A manually constructed instruction dataset. |
|
126 |
+
| |[AnswerCarefully (ver2.0)](https://huggingface.co/datasets/llm-jp/AnswerCarefully)| A manually constructed instruction dataset focusing on LLMs' safety. |
|
127 |
+
| |ichikara-instruction-format| A small subset of the ichikara-instruction dataset, edited with some constraints on the output format. |
|
128 |
+
| |[AutoMultiTurnByCalm3-22B](https://huggingface.co/datasets/kanhatakeyama/AutoMultiTurnByCalm3-22B)| A synthetic instruction dataset. |
|
129 |
+
| |[ramdom-to-fixed-multiturn-Calm3](https://huggingface.co/datasets/kanhatakeyama/ramdom-to-fixed-multiturn-Calm3)| A synthetic instruction dataset. |
|
130 |
+
| |[wizardlm8x22b-logical-math-coding-sft-ja](https://huggingface.co/datasets/llm-jp/wizardlm8x22b-logical-math-coding-sft-ja)| A synthetic instruction dataset. |
|
131 |
+
| |[magpie-sft-v1.0](https://huggingface.co/datasets/llm-jp/magpie-sft-v1.0)| A synthetic instruction dataset we created. |
|
132 |
+
|English|[Daring-Anteater](https://huggingface.co/datasets/nvidia/Daring-Anteater)| - |
|
133 |
+
| |[FLAN](https://huggingface.co/datasets/llm-jp/FLAN/blob/main/README.md) | - |
|
134 |
+
|Japanese & English|[Synthetic-JP-EN-Coding-Dataset](https://huggingface.co/datasets/llm-jp/Synthetic-JP-EN-Coding-Dataset)| A synthetic instruction dataset. |
|
135 |
+
|
136 |
+
|
137 |
+
#### Direct Preference Optimization
|
138 |
+
|
139 |
+
The datasets used for supervised fine-tuning are as follows:
|
140 |
+
|
141 |
+
| Language | Dataset | Description |
|
142 |
+
|:---|:---|:---|
|
143 |
+
|Japanese|[aya-ja-evol-inst](https://huggingface.co/datasets/llm-jp/aya-ja-evol-inst) | A synthetic preference dataset focusing on LLMs' helpfulness. |
|
144 |
+
| |[ac-self-inst](https://huggingface.co/datasets/llm-jp/ac-self-inst)| A synthetic preference dataset focusing on LLMs' safety. |
|
145 |
+
|
146 |
+
|
147 |
+
## Evaluation
|
148 |
+
|
149 |
+
Detailed evaluation results are reported in this blog.
|
150 |
+
|
151 |
+
|
152 |
+
## Risks and Limitations
|
153 |
+
|
154 |
+
The models released here are in the early stages of our research and development and have not been tuned to ensure outputs align with human intent and safety considerations.
|
155 |
+
|
156 |
+
|
157 |
+
## Send Questions to
|
158 |
+
|
159 |
+
llm-jp(at)nii.ac.jp
|
160 |
+
|
161 |
+
|
162 |
+
## License
|
163 |
+
|
164 |
+
[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
165 |
+
|
166 |
+
## Model Card Authors
|
167 |
+
|
168 |
+
*The names are listed in alphabetical order.*
|
169 |
+
|
170 |
+
Hirokazu Kiyomaru and Takashi Kodama.
|