Text Generation
Transformers
mixtral
Not-For-All-Audiences
nsfw
mergekit
Merge
HQQ
2bit
conversational
Inference Endpoints
ProphetOfBostrom
commited on
Commit
•
87a15f8
1
Parent(s):
5a862d4
untested vanilla quant of undi95's
Browse files- HQQbagelmix_def.py +28 -0
- README.md +55 -0
- config.json +30 -0
- qmodel.pt +3 -0
- special_tokens_map.json +23 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +43 -0
HQQbagelmix_def.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from hqq.engine.hf import HQQModelForCausalLM, AutoTokenizer
|
2 |
+
model_path = "/mnt/ancient240/Undi95_BagelMix-8x7B"
|
3 |
+
model = HQQModelForCausalLM.from_pretrained(model_path)
|
4 |
+
|
5 |
+
#Quantize params
|
6 |
+
from hqq.core.quantize import *
|
7 |
+
#attn_prams = BaseQuantizeConfig(nbits=4, group_size=64, quant_zero=True, quant_scale=True)
|
8 |
+
attn_prams = BaseQuantizeConfig(nbits=4, group_size=64, quant_zero=True, quant_scale=True)
|
9 |
+
attn_prams['scale_quant_params']['group_size'] = 256
|
10 |
+
experts_params = BaseQuantizeConfig(nbits=2, group_size=16, quant_zero=True, quant_scale=True)
|
11 |
+
|
12 |
+
quant_config = {}
|
13 |
+
#Attention
|
14 |
+
quant_config['self_attn.q_proj'] = attn_prams
|
15 |
+
quant_config['self_attn.k_proj'] = attn_prams
|
16 |
+
quant_config['self_attn.v_proj'] = attn_prams
|
17 |
+
quant_config['self_attn.o_proj'] = attn_prams
|
18 |
+
#Experts
|
19 |
+
quant_config['block_sparse_moe.experts.w1'] = experts_params
|
20 |
+
quant_config['block_sparse_moe.experts.w2'] = experts_params
|
21 |
+
quant_config['block_sparse_moe.experts.w3'] = experts_params
|
22 |
+
#print("configured")
|
23 |
+
#Quantize
|
24 |
+
save_path="models/BagelMix-8x7B-2g16-4g64-HQQ/"
|
25 |
+
model.quantize_model(quant_config=quant_config)
|
26 |
+
model.save_quantized(save_path)
|
27 |
+
|
28 |
+
#brought to you by python -i
|
README.md
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model:
|
3 |
+
- Doctor-Shotgun/Mixtral-8x7B-Instruct-v0.1-LimaRP-ZLoss
|
4 |
+
- jondurbin/bagel-dpo-8x7b-v0.2
|
5 |
+
- NeverSleep/Noromaid-v0.4-Mixtral-Instruct-8x7b-Zloss
|
6 |
+
license: cc-by-nc-4.0
|
7 |
+
tags:
|
8 |
+
- not-for-all-audiences
|
9 |
+
- nsfw
|
10 |
+
- mergekit
|
11 |
+
- merge
|
12 |
+
|
13 |
+
---
|
14 |
+
# BagelMix
|
15 |
+
|
16 |
+
This is a merge of pre-trained language models created using [mergekit](https://github.com/cg123/mergekit).
|
17 |
+
|
18 |
+
## Merge Details
|
19 |
+
### Merge Method
|
20 |
+
|
21 |
+
This model was merged using the [DARE](https://arxiv.org/abs/2311.03099) [TIES](https://arxiv.org/abs/2306.01708) merge method using [jondurbin/bagel-dpo-8x7b-v0.2](https://huggingface.co/jondurbin/bagel-dpo-8x7b-v0.2) as a base.
|
22 |
+
|
23 |
+
### Models Merged
|
24 |
+
|
25 |
+
The following models were included in the merge:
|
26 |
+
* [Doctor-Shotgun/Mixtral-8x7B-Instruct-v0.1-LimaRP-ZLoss](https://huggingface.co/Doctor-Shotgun/Mixtral-8x7B-Instruct-v0.1-LimaRP-ZLoss)
|
27 |
+
* [NeverSleep/Noromaid-v0.4-Mixtral-Instruct-8x7b-Zloss](https://huggingface.co/NeverSleep/Noromaid-v0.4-Mixtral-Instruct-8x7b-Zloss)
|
28 |
+
|
29 |
+
### Configuration
|
30 |
+
|
31 |
+
The following YAML configuration was used to produce this model:
|
32 |
+
|
33 |
+
```yaml
|
34 |
+
models:
|
35 |
+
- model: jondurbin/bagel-dpo-8x7b-v0.2
|
36 |
+
parameters:
|
37 |
+
density: 1.0
|
38 |
+
weight: 1.0
|
39 |
+
- model: Doctor-Shotgun/Mixtral-8x7B-Instruct-v0.1-LimaRP-ZLoss
|
40 |
+
parameters:
|
41 |
+
density: 0.5
|
42 |
+
weight: [0.33, 0.4, 0.33]
|
43 |
+
- model: NeverSleep/Noromaid-v0.4-Mixtral-Instruct-8x7b-Zloss
|
44 |
+
parameters:
|
45 |
+
density: [0.33, 0.45, 0.66]
|
46 |
+
weight: 0.66
|
47 |
+
merge_method: dare_ties
|
48 |
+
base_model: jondurbin/bagel-dpo-8x7b-v0.2
|
49 |
+
parameters:
|
50 |
+
normalize: true
|
51 |
+
int8_mask: true
|
52 |
+
dtype: bfloat16
|
53 |
+
tokenizer_source : union
|
54 |
+
```
|
55 |
+
If you want to support me, you can [here](https://ko-fi.com/undiai).
|
config.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/mnt/ancient240/Undi95_BagelMix-8x7B",
|
3 |
+
"architectures": [
|
4 |
+
"MixtralForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 1,
|
8 |
+
"eos_token_id": 2,
|
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 |
+
"rms_norm_eps": 1e-05,
|
22 |
+
"rope_theta": 1000000.0,
|
23 |
+
"router_aux_loss_coef": 0.02,
|
24 |
+
"sliding_window": null,
|
25 |
+
"tie_word_embeddings": false,
|
26 |
+
"torch_dtype": "bfloat16",
|
27 |
+
"transformers_version": "4.37.1",
|
28 |
+
"use_cache": true,
|
29 |
+
"vocab_size": 32000
|
30 |
+
}
|
qmodel.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7fe1dfdc2993e62bc38d82d52a4c521544cfdb4ab535da1ca76341dff786cfcd
|
3 |
+
size 18241882036
|
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:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
|
3 |
+
size 493443
|
tokenizer_config.json
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"bos_token": "<s>",
|
32 |
+
"chat_template": "{%- for idx in range(0, messages|length) -%}\n{%- if messages[idx]['role'] == 'user' -%}\n{%- if idx > 1 -%}\n{{- bos_token + '[INST] ' + messages[idx]['content'] + ' [/INST]' -}}\n{%- else -%}\n{{- messages[idx]['content'] + ' [/INST]' -}}\n{%- endif -%}\n{% elif messages[idx]['role'] == 'system' %}\n{{- '[INST] <<SYS>>\\n' + messages[idx]['content'] + '\\n<</SYS>>\\n\\n' -}}\n{%- elif messages[idx]['role'] == 'assistant' -%}\n{{- ' ' + messages[idx]['content'] + ' ' + eos_token -}}\n{% endif %}\n{% endfor %}",
|
33 |
+
"clean_up_tokenization_spaces": false,
|
34 |
+
"eos_token": "</s>",
|
35 |
+
"legacy": true,
|
36 |
+
"model_max_length": 1000000000000000019884624838656,
|
37 |
+
"pad_token": null,
|
38 |
+
"sp_model_kwargs": {},
|
39 |
+
"spaces_between_special_tokens": false,
|
40 |
+
"tokenizer_class": "LlamaTokenizer",
|
41 |
+
"unk_token": "<unk>",
|
42 |
+
"use_default_system_prompt": false
|
43 |
+
}
|