kimleang123 commited on
Commit
acbee06
·
verified ·
1 Parent(s): 28e50b5

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - mistralai/Mixtral-8x7B-v0.1
4
+ license: apache-2.0
5
+ language:
6
+ - fr
7
+ - it
8
+ - de
9
+ - es
10
+ - en
11
+ tags:
12
+ - bnb-my-repo
13
+ - moe
14
+
15
+ extra_gated_description: If you want to learn more about how we process your personal data, please read our <a href="https://mistral.ai/fr/terms/">Privacy Policy</a>.
16
+ ---
17
+ # mistralai/Mixtral-8x7B-v0.1 (Quantized)
18
+
19
+ ## Description
20
+ This model is a quantized version of the original model [`mistralai/Mixtral-8x7B-v0.1`](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1).
21
+
22
+ It's quantized using the BitsAndBytes library to 4-bit using the [bnb-my-repo](https://huggingface.co/spaces/bnb-community/bnb-my-repo) space.
23
+
24
+ ## Quantization Details
25
+ - **Quantization Type**: int4
26
+ - **bnb_4bit_quant_type**: nf4
27
+ - **bnb_4bit_use_double_quant**: True
28
+ - **bnb_4bit_compute_dtype**: bfloat16
29
+ - **bnb_4bit_quant_storage**: bfloat16
30
+
31
+
32
+
33
+ # 📄 Original Model Information
34
+
35
+
36
+ # Model Card for Mixtral-8x7B
37
+ The Mixtral-8x7B Large Language Model (LLM) is a pretrained generative Sparse Mixture of Experts. The Mistral-8x7B outperforms Llama 2 70B on most benchmarks we tested.
38
+
39
+ For full details of this model please read our [release blog post](https://mistral.ai/news/mixtral-of-experts/).
40
+
41
+ ## Warning
42
+ This repo contains weights that are compatible with [vLLM](https://github.com/vllm-project/vllm) serving of the model as well as Hugging Face [transformers](https://github.com/huggingface/transformers) library. It is based on the original Mixtral [torrent release](magnet:?xt=urn:btih:5546272da9065eddeb6fcd7ffddeef5b75be79a7&dn=mixtral-8x7b-32kseqlen&tr=udp%3A%2F%http://2Fopentracker.i2p.rocks%3A6969%2Fannounce&tr=http%3A%2F%http://2Ftracker.openbittorrent.com%3A80%2Fannounce), but the file format and parameter names are different. Please note that model cannot (yet) be instantiated with HF.
43
+
44
+ ## Run the model
45
+
46
+
47
+ ```python
48
+ from transformers import AutoModelForCausalLM, AutoTokenizer
49
+
50
+ model_id = "mistralai/Mixtral-8x7B-v0.1"
51
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
52
+
53
+ model = AutoModelForCausalLM.from_pretrained(model_id)
54
+
55
+ text = "Hello my name is"
56
+ inputs = tokenizer(text, return_tensors="pt")
57
+
58
+ outputs = model.generate(**inputs, max_new_tokens=20)
59
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
60
+ ```
61
+
62
+ By default, transformers will load the model in full precision. Therefore you might be interested to further reduce down the memory requirements to run the model through the optimizations we offer in HF ecosystem:
63
+
64
+ ### In half-precision
65
+
66
+ Note `float16` precision only works on GPU devices
67
+
68
+ <details>
69
+ <summary> Click to expand </summary>
70
+
71
+ ```diff
72
+ + import torch
73
+ from transformers import AutoModelForCausalLM, AutoTokenizer
74
+
75
+ model_id = "mistralai/Mixtral-8x7B-v0.1"
76
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
77
+
78
+ + model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16).to(0)
79
+
80
+ text = "Hello my name is"
81
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
82
+
83
+ outputs = model.generate(**inputs, max_new_tokens=20)
84
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
85
+ ```
86
+ </details>
87
+
88
+ ### Lower precision using (8-bit & 4-bit) using `bitsandbytes`
89
+
90
+ <details>
91
+ <summary> Click to expand </summary>
92
+
93
+ ```diff
94
+ + import torch
95
+ from transformers import AutoModelForCausalLM, AutoTokenizer
96
+
97
+ model_id = "mistralai/Mixtral-8x7B-v0.1"
98
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
99
+
100
+ + model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True)
101
+
102
+ text = "Hello my name is"
103
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
104
+
105
+ outputs = model.generate(**inputs, max_new_tokens=20)
106
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
107
+ ```
108
+ </details>
109
+
110
+ ### Load the model with Flash Attention 2
111
+
112
+ <details>
113
+ <summary> Click to expand </summary>
114
+
115
+ ```diff
116
+ + import torch
117
+ from transformers import AutoModelForCausalLM, AutoTokenizer
118
+
119
+ model_id = "mistralai/Mixtral-8x7B-v0.1"
120
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
121
+
122
+ + model = AutoModelForCausalLM.from_pretrained(model_id, use_flash_attention_2=True)
123
+
124
+ text = "Hello my name is"
125
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
126
+
127
+ outputs = model.generate(**inputs, max_new_tokens=20)
128
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
129
+ ```
130
+ </details>
131
+
132
+ ## Notice
133
+ Mixtral-8x7B is a pretrained base model and therefore does not have any moderation mechanisms.
134
+
135
+ # The Mistral AI Team
136
+ Albert Jiang, Alexandre Sablayrolles, Arthur Mensch, Blanche Savary, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Emma Bou Hanna, Florian Bressand, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Lélio Renard Lavaud, Louis Ternon, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Théophile Gervet, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed.
config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "mistralai/Mixtral-8x7B-v0.1",
3
+ "architectures": [
4
+ "MixtralModel"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 1,
8
+ "eos_token_id": 2,
9
+ "head_dim": 128,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 4096,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 14336,
14
+ "max_position_embeddings": 32768,
15
+ "model_type": "mixtral",
16
+ "num_attention_heads": 32,
17
+ "num_experts_per_tok": 2,
18
+ "num_hidden_layers": 32,
19
+ "num_key_value_heads": 8,
20
+ "num_local_experts": 8,
21
+ "output_router_logits": false,
22
+ "quantization_config": {
23
+ "_load_in_4bit": true,
24
+ "_load_in_8bit": false,
25
+ "bnb_4bit_compute_dtype": "bfloat16",
26
+ "bnb_4bit_quant_storage": "bfloat16",
27
+ "bnb_4bit_quant_type": "nf4",
28
+ "bnb_4bit_use_double_quant": true,
29
+ "llm_int8_enable_fp32_cpu_offload": false,
30
+ "llm_int8_has_fp16_weight": false,
31
+ "llm_int8_skip_modules": null,
32
+ "llm_int8_threshold": 6.0,
33
+ "load_in_4bit": true,
34
+ "load_in_8bit": false,
35
+ "quant_method": "bitsandbytes"
36
+ },
37
+ "rms_norm_eps": 1e-05,
38
+ "rope_theta": 1000000.0,
39
+ "router_aux_loss_coef": 0.02,
40
+ "router_jitter_noise": 0.0,
41
+ "sliding_window": null,
42
+ "tie_word_embeddings": false,
43
+ "torch_dtype": "bfloat16",
44
+ "transformers_version": "4.49.0",
45
+ "use_cache": true,
46
+ "vocab_size": 32000
47
+ }
model-00001-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:935e22e6ff355ec12d03244d5ac48b27c197ee9f804b2bfabf37f3b496c18567
3
+ size 4988283912
model-00002-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ced506a101279372a5c8c9239fe602ee1ddba8fed7b5b7e5dcdebbff64b5b4d
3
+ size 4977122528
model-00003-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:82ac5b77fc9778d29365461a0e41f21e8a37582ae09f2e7913f6cbaceb845efe
3
+ size 4998803584
model-00004-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d1850bc4dbf06d23432b926f74975994a4ea27a73c0d09c9d71b4ea9e716c56
3
+ size 4998803577
model-00005-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7269ad8772fc0c0f23fc8c74ab8fb44e98364237de3e20aadd063be8254f3a63
3
+ size 4258705476
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
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_config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": null,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<unk>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "</s>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ }
30
+ },
31
+ "additional_special_tokens": [],
32
+ "bos_token": "<s>",
33
+ "clean_up_tokenization_spaces": false,
34
+ "eos_token": "</s>",
35
+ "extra_special_tokens": {},
36
+ "legacy": true,
37
+ "model_max_length": 1000000000000000019884624838656,
38
+ "pad_token": null,
39
+ "sp_model_kwargs": {},
40
+ "spaces_between_special_tokens": false,
41
+ "tokenizer_class": "LlamaTokenizer",
42
+ "unk_token": "<unk>",
43
+ "use_default_system_prompt": false
44
+ }