SushiTokyo commited on
Commit
ccc6e89
·
verified ·
1 Parent(s): 0b2b94a
config.json ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "SushiTokyo/ELYZA-japanese-Llama-2-13b-fast-instruct-4bit-quantized",
3
+ "architectures": [
4
+ "LlamaForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 1,
9
+ "eos_token_id": 2,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 5120,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 13824,
14
+ "max_position_embeddings": 4096,
15
+ "model_type": "llama",
16
+ "num_attention_heads": 40,
17
+ "num_hidden_layers": 40,
18
+ "num_key_value_heads": 40,
19
+ "pad_token_id": 2,
20
+ "pretraining_tp": 1,
21
+ "quantization_config": {
22
+ "batch_size": 1,
23
+ "bits": 4,
24
+ "block_name_to_quantize": null,
25
+ "cache_block_outputs": true,
26
+ "damp_percent": 0.1,
27
+ "dataset": "c4",
28
+ "desc_act": false,
29
+ "exllama_config": {
30
+ "version": 1
31
+ },
32
+ "group_size": 64,
33
+ "max_input_length": null,
34
+ "model_seqlen": null,
35
+ "module_name_preceding_first_block": null,
36
+ "modules_in_block_to_quantize": null,
37
+ "pad_token_id": null,
38
+ "quant_method": "gptq",
39
+ "sym": true,
40
+ "tokenizer": null,
41
+ "true_sequential": true,
42
+ "use_cuda_fp16": false,
43
+ "use_exllama": true
44
+ },
45
+ "rms_norm_eps": 1e-05,
46
+ "rope_scaling": null,
47
+ "rope_theta": 10000.0,
48
+ "tie_word_embeddings": false,
49
+ "torch_dtype": "float16",
50
+ "transformers_version": "4.40.1",
51
+ "use_cache": true,
52
+ "vocab_size": 44581
53
+ }
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": 2,
6
+ "transformers_version": "4.40.1"
7
+ }
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee4a25030bfca8e7ed4bea9747664274082278e76308e2f3b55ac37199df80c1
3
+ size 4966876440
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c04e72e0fb82031456d9aa6efe99c1ba2bde9e706af028a89b80c00d1e4ccbe
3
+ size 2798025296
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
quantize.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoModelForCausalLM, AutoTokenizer, GPTQConfig
2
+ model_id = "elyza/ELYZA-japanese-Llama-2-13b-fast-instruct"
3
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
4
+ gptq_config = GPTQConfig(bits=4, dataset = "c4", tokenizer=tokenizer, group_size=64)
5
+ model = AutoModelForCausalLM.from_pretrained(model_id, device_map="cuda", quantization_config=gptq_config)
6
+
7
+ tokenizer.save_pretrained("./quantized")
8
+ model.save_pretrained("./quantized")
readme.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## About
2
+ ELYZA-japanese-Llama-2-13b-fast-instruct を4bitで量子化したモデルです。
3
+ ref: https://huggingface.co/elyza/ELYZA-japanese-Llama-2-13b-fast-instruct/blob/main/README.md
4
+
5
+ オリジナルはRTX4090でも扱いが難しかったですが、10秒ほどで出力できます。
6
+ 精度は未計測。
7
+
8
+ 量子化の詳細はconfig.jsonを参照してください。
9
+ コードはquantize.pyです。
10
+
11
+ ## LICENSE
12
+ LICENSE: LLAMA2
special_tokens_map.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<unk>",
4
+ "<s>",
5
+ "</s>"
6
+ ],
7
+ "bos_token": {
8
+ "content": "<s>",
9
+ "lstrip": false,
10
+ "normalized": false,
11
+ "rstrip": false,
12
+ "single_word": false
13
+ },
14
+ "eos_token": {
15
+ "content": "</s>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ },
21
+ "pad_token": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false
27
+ },
28
+ "unk_token": {
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false
34
+ }
35
+ }
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:21715bf9f86ad0ba1236012f5aadee93239306fe0b87a448532e3299865fa36f
3
+ size 705214
tokenizer_config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ }
29
+ },
30
+ "additional_special_tokens": [
31
+ "<unk>",
32
+ "<s>",
33
+ "</s>"
34
+ ],
35
+ "bos_token": "<s>",
36
+ "clean_up_tokenization_spaces": false,
37
+ "eos_token": "</s>",
38
+ "legacy": true,
39
+ "model_max_length": 1000000000000000019884624838656,
40
+ "pad_token": "</s>",
41
+ "padding_side": "right",
42
+ "sp_model_kwargs": {},
43
+ "spaces_between_special_tokens": false,
44
+ "tokenizer_class": "LlamaTokenizer",
45
+ "unk_token": "<unk>",
46
+ "use_default_system_prompt": false
47
+ }