Upload 5 files
Browse files- README.md +49 -0
- config.json +36 -0
- model.safetensors +3 -0
- pytorch_model.bin +3 -0
- quantize_config.json +11 -0
README.md
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
inference: false
|
4 |
+
language: ja
|
5 |
+
---
|
6 |
+
|
7 |
+
# japanese-large-lm-1.7b-instruction-sft-4bit-128g-actorder_False
|
8 |
+
|
9 |
+
This repository provides a 1.7B parameters Japanese language **quantized** model, fine-tuned and trained by [LINE Corporation](https://linecorp.com/ja/).
|
10 |
+
|
11 |
+
## For Japanese
|
12 |
+
|
13 |
+
詳細な説明や実験に関しては「[【インターンレポート】量子化による大規模言語モデル軽量化の効果測定](https://engineering.linecorp.com/ja/blog/quantization-lightweighting-llms)」をご覧ください。
|
14 |
+
|
15 |
+
## How to use
|
16 |
+
|
17 |
+
```python
|
18 |
+
import torch
|
19 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
20 |
+
|
21 |
+
tokenizer = AutoTokenizer.from_pretrained("line-corporation/japanese-large-lm-1.7b-instruction-sft", use_fast=False)
|
22 |
+
model = AutoModelForCausalLM.from_pretrained("line-corporation/japanese-large-lm-1.7b-instruction-sft-4bit-128g-actorder_False")
|
23 |
+
|
24 |
+
generator = pipeline("text-generation", model=model, tokenizer=tokenizer, device=0)
|
25 |
+
|
26 |
+
input_text = """四国の県名を全て列挙してください。"""
|
27 |
+
text = generator(
|
28 |
+
f"ユーザー: {input_text}\nシステム: ",
|
29 |
+
max_length = 256,
|
30 |
+
do_sample = True,
|
31 |
+
temperature = 0.7,
|
32 |
+
top_p = 0.9,
|
33 |
+
top_k = 0,
|
34 |
+
repetition_penalty = 1.1,
|
35 |
+
num_beams = 1,
|
36 |
+
pad_token_id = tokenizer.pad_token_id,
|
37 |
+
num_return_sequences = 1,
|
38 |
+
)
|
39 |
+
print(text) # [{'generated_text': 'ユーザー: 四国の県名を全て列挙してください。\nシステム: 高知県、徳島県、香川県、愛媛県'}]
|
40 |
+
```
|
41 |
+
|
42 |
+
## Tokenization
|
43 |
+
|
44 |
+
We use a sentencepiece tokenizer with a unigram language model and byte-fallback.
|
45 |
+
We **do not** apply pre-tokenization with Japanese tokenizer.
|
46 |
+
Thus, a user may directly feed raw sentences into the tokenizer.
|
47 |
+
|
48 |
+
## License
|
49 |
+
[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
config.json
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "line-corporation/japanese-large-lm-1.7b-instruction-sft",
|
3 |
+
"activation_function": "gelu",
|
4 |
+
"architectures": [
|
5 |
+
"GPT2LMHeadModel"
|
6 |
+
],
|
7 |
+
"attn_pdrop": 0.1,
|
8 |
+
"bos_token_id": 1,
|
9 |
+
"embd_pdrop": 0.1,
|
10 |
+
"end_token_id": 2,
|
11 |
+
"eos_token_id": 2,
|
12 |
+
"gradient_checkpointing": false,
|
13 |
+
"initializer_range": 0.02,
|
14 |
+
"layer_norm_epsilon": 1e-05,
|
15 |
+
"model_type": "gpt2",
|
16 |
+
"n_ctx": 2048,
|
17 |
+
"n_embd": 2304,
|
18 |
+
"n_head": 24,
|
19 |
+
"n_inner": 9216,
|
20 |
+
"n_layer": 24,
|
21 |
+
"n_positions": 2048,
|
22 |
+
"pad_token_id": 2,
|
23 |
+
"reorder_and_upcast_attn": false,
|
24 |
+
"resid_pdrop": 0.1,
|
25 |
+
"scale_attn_by_inverse_layer_idx": false,
|
26 |
+
"scale_attn_weights": true,
|
27 |
+
"summary_activation": null,
|
28 |
+
"summary_first_dropout": 0.1,
|
29 |
+
"summary_proj_to_labels": true,
|
30 |
+
"summary_type": "cls_index",
|
31 |
+
"summary_use_proj": true,
|
32 |
+
"torch_dtype": "float16",
|
33 |
+
"transformers_version": "4.33.0",
|
34 |
+
"use_cache": true,
|
35 |
+
"vocab_size": 51200
|
36 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d686278ac51fca65d4b14cd8c2de78be8fd16df2792aa5ca3c3128cd5ddf12ef
|
3 |
+
size 1278624744
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5c053b85bfb39fac8b84124fe8986405cf94ee55b9533909316c0a74ef9c7b65
|
3 |
+
size 1042836115
|
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": "quantized/line-corporation/japanese-large-lm-1.7b-instruction-sft/gptq-4bit-128g-actorder_False",
|
10 |
+
"model_file_base_name": "gptq_model-4bit-128g"
|
11 |
+
}
|