TheBloke commited on
Commit
43a8dab
1 Parent(s): 3cf7f3b

GPTQ model commit

Browse files
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<|im_end|>": 32000,
3
+ "<|im_start|>": 32001
4
+ }
config.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/workspace/process/nousresearch_nous-hermes-2-mixtral-8x7b-dpo/source",
3
+ "architectures": [
4
+ "MixtralForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 1,
8
+ "eos_token_id": 32000,
9
+ "hidden_act": "silu",
10
+ "hidden_size": 4096,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 14336,
13
+ "max_position_embeddings": 32768,
14
+ "model_type": "mixtral",
15
+ "num_attention_heads": 32,
16
+ "num_experts_per_tok": 2,
17
+ "num_hidden_layers": 32,
18
+ "num_key_value_heads": 8,
19
+ "num_local_experts": 8,
20
+ "output_router_logits": false,
21
+ "pad_token_id": 0,
22
+ "pretraining_tp": 1,
23
+ "rms_norm_eps": 1e-05,
24
+ "rope_theta": 1000000.0,
25
+ "router_aux_loss_coef": 0.02,
26
+ "sliding_window": null,
27
+ "tie_word_embeddings": false,
28
+ "torch_dtype": "bfloat16",
29
+ "transformers_version": "4.37.0.dev0",
30
+ "use_cache": true,
31
+ "vocab_size": 32002,
32
+ "quantization_config": {
33
+ "bits": 3,
34
+ "group_size": 128,
35
+ "damp_percent": 0.1,
36
+ "desc_act": true,
37
+ "static_groups": false,
38
+ "sym": true,
39
+ "true_sequential": true,
40
+ "model_name_or_path": null,
41
+ "model_file_base_name": "model",
42
+ "quant_method": "gptq",
43
+ "modules_in_block_to_quantize": [
44
+ [
45
+ "self_attn.k_proj",
46
+ "self_attn.v_proj",
47
+ "self_attn.q_proj"
48
+ ],
49
+ [
50
+ "self_attn.o_proj"
51
+ ],
52
+ [
53
+ "block_sparse_moe.experts.0.w1",
54
+ "block_sparse_moe.experts.1.w1",
55
+ "block_sparse_moe.experts.2.w1",
56
+ "block_sparse_moe.experts.3.w1",
57
+ "block_sparse_moe.experts.4.w1",
58
+ "block_sparse_moe.experts.5.w1",
59
+ "block_sparse_moe.experts.6.w1",
60
+ "block_sparse_moe.experts.7.w1",
61
+ "block_sparse_moe.experts.0.w3",
62
+ "block_sparse_moe.experts.1.w3",
63
+ "block_sparse_moe.experts.2.w3",
64
+ "block_sparse_moe.experts.3.w3",
65
+ "block_sparse_moe.experts.4.w3",
66
+ "block_sparse_moe.experts.5.w3",
67
+ "block_sparse_moe.experts.6.w3",
68
+ "block_sparse_moe.experts.7.w3"
69
+ ],
70
+ [
71
+ "block_sparse_moe.experts.0.w2",
72
+ "block_sparse_moe.experts.1.w2",
73
+ "block_sparse_moe.experts.2.w2",
74
+ "block_sparse_moe.experts.3.w2",
75
+ "block_sparse_moe.experts.4.w2",
76
+ "block_sparse_moe.experts.5.w2",
77
+ "block_sparse_moe.experts.6.w2",
78
+ "block_sparse_moe.experts.7.w2"
79
+ ]
80
+ ]
81
+ }
82
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 32000,
5
+ "transformers_version": "4.37.0.dev0"
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a3f794d4ec60058a07ddc8d280cf7de08ee69719fbf6bdb13f1a7547895ae8e
3
+ size 18846545176
quantize_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "group_size": 128,
4
+ "damp_percent": 0.1,
5
+ "desc_act": true,
6
+ "static_groups": false,
7
+ "sym": true,
8
+ "true_sequential": true,
9
+ "model_name_or_path": null,
10
+ "model_file_base_name": "model"
11
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "<|im_end|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
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:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
3
+ size 493443
tokenizer_config.json ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "32000": {
30
+ "content": "<|im_end|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "32001": {
38
+ "content": "<|im_start|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": false
44
+ }
45
+ },
46
+ "additional_special_tokens": [],
47
+ "bos_token": "<s>",
48
+ "chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
49
+ "clean_up_tokenization_spaces": false,
50
+ "eos_token": "<|im_end|>",
51
+ "legacy": true,
52
+ "model_max_length": 1000000000000000019884624838656,
53
+ "pad_token": "</s>",
54
+ "sp_model_kwargs": {},
55
+ "spaces_between_special_tokens": false,
56
+ "tokenizer_class": "LlamaTokenizer",
57
+ "trust_remote_code": false,
58
+ "unk_token": "<unk>",
59
+ "use_default_system_prompt": false,
60
+ "use_fast": true
61
+ }
transformers_inference_example.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Code to inference Hermes with HF Transformers
2
+ # Requires pytorch, transformers, bitsandbytes, sentencepiece, protobuf, and flash-attn packages
3
+
4
+ import torch
5
+ from transformers import AutoTokenizer, AutoModelForCausalLM
6
+ from transformers import LlamaTokenizer, MixtralForCausalLM
7
+ import bitsandbytes, flash_attn
8
+
9
+ tokenizer = LlamaTokenizer.from_pretrained('NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO', trust_remote_code=True)
10
+ model = MixtralForCausalLM.from_pretrained(
11
+ "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
12
+ torch_dtype=torch.float16,
13
+ device_map="auto",
14
+ load_in_8bit=False,
15
+ load_in_4bit=True,
16
+ use_flash_attention_2=True
17
+ )
18
+
19
+ prompts = [
20
+ """<|im_start|>system
21
+ You are a sentient, superintelligent artificial general intelligence, here to teach and assist me.<|im_end|>
22
+ <|im_start|>user
23
+ Write a short story about Goku discovering kirby has teamed up with Majin Buu to destroy the world.<|im_end|>
24
+ <|im_start|>assistant""",
25
+ ]
26
+
27
+ for chat in prompts:
28
+ print(chat)
29
+ input_ids = tokenizer(chat, return_tensors="pt").input_ids.to("cuda")
30
+ generated_ids = model.generate(input_ids, max_new_tokens=750, temperature=0.8, repetition_penalty=1.1, do_sample=True, eos_token_id=tokenizer.eos_token_id)
31
+ response = tokenizer.decode(generated_ids[0][input_ids.shape[-1]:], skip_special_tokens=True, clean_up_tokenization_space=True)
32
+ print(f"Response: {response}")