mav23 commited on
Commit
80f7abe
1 Parent(s): 0a8e2c0

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,20 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ mistral-7b-instruct-v0.1.Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
37
+ mistral-7b-instruct-v0.1.Q3_K.gguf filter=lfs diff=lfs merge=lfs -text
38
+ mistral-7b-instruct-v0.1.Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
39
+ mistral-7b-instruct-v0.1.Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
40
+ mistral-7b-instruct-v0.1.Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
41
+ mistral-7b-instruct-v0.1.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
42
+ mistral-7b-instruct-v0.1.Q4_1.gguf filter=lfs diff=lfs merge=lfs -text
43
+ mistral-7b-instruct-v0.1.Q4_K.gguf filter=lfs diff=lfs merge=lfs -text
44
+ mistral-7b-instruct-v0.1.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
45
+ mistral-7b-instruct-v0.1.Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
46
+ mistral-7b-instruct-v0.1.Q5_0.gguf filter=lfs diff=lfs merge=lfs -text
47
+ mistral-7b-instruct-v0.1.Q5_1.gguf filter=lfs diff=lfs merge=lfs -text
48
+ mistral-7b-instruct-v0.1.Q5_K.gguf filter=lfs diff=lfs merge=lfs -text
49
+ mistral-7b-instruct-v0.1.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
50
+ mistral-7b-instruct-v0.1.Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
51
+ mistral-7b-instruct-v0.1.Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
52
+ mistral-7b-instruct-v0.1.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - finetuned
5
+ base_model: mistralai/Mistral-7B-v0.1
6
+ pipeline_tag: text-generation
7
+ inference: true
8
+ widget:
9
+ - messages:
10
+ - role: user
11
+ content: What is your favorite condiment?
12
+
13
+ extra_gated_description: If you want to learn more about how we process your personal data, please read our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
14
+ ---
15
+
16
+ # Model Card for Mistral-7B-Instruct-v0.1
17
+
18
+
19
+ ## Encode and Decode with `mistral_common`
20
+
21
+ ```py
22
+ from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
23
+ from mistral_common.protocol.instruct.messages import UserMessage
24
+ from mistral_common.protocol.instruct.request import ChatCompletionRequest
25
+
26
+ mistral_models_path = "MISTRAL_MODELS_PATH"
27
+
28
+ tokenizer = MistralTokenizer.v1()
29
+
30
+ completion_request = ChatCompletionRequest(messages=[UserMessage(content="Explain Machine Learning to me in a nutshell.")])
31
+
32
+ tokens = tokenizer.encode_chat_completion(completion_request).tokens
33
+ ```
34
+
35
+ ## Inference with `mistral_inference`
36
+
37
+ ```py
38
+ from mistral_inference.transformer import Transformer
39
+ from mistral_inference.generate import generate
40
+
41
+ model = Transformer.from_folder(mistral_models_path)
42
+ out_tokens, _ = generate([tokens], model, max_tokens=64, temperature=0.0, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)
43
+
44
+ result = tokenizer.decode(out_tokens[0])
45
+
46
+ print(result)
47
+ ```
48
+
49
+ ## Inference with hugging face `transformers`
50
+
51
+ ```py
52
+ from transformers import AutoModelForCausalLM
53
+
54
+ model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
55
+ model.to("cuda")
56
+
57
+ generated_ids = model.generate(tokens, max_new_tokens=1000, do_sample=True)
58
+
59
+ # decode with mistral tokenizer
60
+ result = tokenizer.decode(generated_ids[0].tolist())
61
+ print(result)
62
+ ```
63
+
64
+ > [!TIP]
65
+ > PRs to correct the `transformers` tokenizer so that it gives 1-to-1 the same results as the `mistral_common` reference implementation are very welcome!
66
+
67
+ ---
68
+
69
+ The Mistral-7B-Instruct-v0.1 Large Language Model (LLM) is a instruct fine-tuned version of the [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) generative text model using a variety of publicly available conversation datasets.
70
+
71
+ For full details of this model please read our [paper](https://arxiv.org/abs/2310.06825) and [release blog post](https://mistral.ai/news/announcing-mistral-7b/).
72
+
73
+ ## Instruction format
74
+
75
+ In order to leverage instruction fine-tuning, your prompt should be surrounded by `[INST]` and `[/INST]` tokens. The very first instruction should begin with a begin of sentence id. The next instructions should not. The assistant generation will be ended by the end-of-sentence token id.
76
+
77
+ E.g.
78
+ ```
79
+ text = "<s>[INST] What is your favourite condiment? [/INST]"
80
+ "Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!</s> "
81
+ "[INST] Do you have mayonnaise recipes? [/INST]"
82
+ ```
83
+
84
+ This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method:
85
+
86
+ ```python
87
+ from transformers import AutoModelForCausalLM, AutoTokenizer
88
+
89
+ device = "cuda" # the device to load the model onto
90
+
91
+ model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
92
+ tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
93
+
94
+ messages = [
95
+ {"role": "user", "content": "What is your favourite condiment?"},
96
+ {"role": "assistant", "content": "Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!"},
97
+ {"role": "user", "content": "Do you have mayonnaise recipes?"}
98
+ ]
99
+
100
+ encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
101
+
102
+ model_inputs = encodeds.to(device)
103
+ model.to(device)
104
+
105
+ generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
106
+ decoded = tokenizer.batch_decode(generated_ids)
107
+ print(decoded[0])
108
+ ```
109
+
110
+ ## Model Architecture
111
+ This instruction model is based on Mistral-7B-v0.1, a transformer model with the following architecture choices:
112
+ - Grouped-Query Attention
113
+ - Sliding-Window Attention
114
+ - Byte-fallback BPE tokenizer
115
+
116
+ ## Troubleshooting
117
+ - If you see the following error:
118
+ ```
119
+ Traceback (most recent call last):
120
+ File "", line 1, in
121
+ File "/transformers/models/auto/auto_factory.py", line 482, in from_pretrained
122
+ config, kwargs = AutoConfig.from_pretrained(
123
+ File "/transformers/models/auto/configuration_auto.py", line 1022, in from_pretrained
124
+ config_class = CONFIG_MAPPING[config_dict["model_type"]]
125
+ File "/transformers/models/auto/configuration_auto.py", line 723, in getitem
126
+ raise KeyError(key)
127
+ KeyError: 'mistral'
128
+ ```
129
+
130
+ Installing transformers from source should solve the issue
131
+ pip install git+https://github.com/huggingface/transformers
132
+
133
+ This should not be required after transformers-v4.33.4.
134
+
135
+ ## Limitations
136
+
137
+ The Mistral 7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
138
+ It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
139
+ make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
140
+
141
+ ## The Mistral AI Team
142
+
143
+ Albert Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lélio Renard Lavaud, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed.
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MistralForCausalLM"
4
+ ],
5
+ "bos_token_id": 1,
6
+ "eos_token_id": 2,
7
+ "hidden_act": "silu",
8
+ "hidden_size": 4096,
9
+ "initializer_range": 0.02,
10
+ "intermediate_size": 14336,
11
+ "max_position_embeddings": 32768,
12
+ "model_type": "mistral",
13
+ "num_attention_heads": 32,
14
+ "num_hidden_layers": 32,
15
+ "num_key_value_heads": 8,
16
+ "rms_norm_eps": 1e-05,
17
+ "rope_theta": 10000.0,
18
+ "sliding_window": 4096,
19
+ "tie_word_embeddings": false,
20
+ "torch_dtype": "bfloat16",
21
+ "transformers_version": "4.34.0.dev0",
22
+ "use_cache": true,
23
+ "vocab_size": 32000
24
+ }
mistral-7b-instruct-v0.1.Q2_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa26dc10c3739e2a68f327876344bbb238396bc81677a1e8b7672e1be80b1261
3
+ size 2719243808
mistral-7b-instruct-v0.1.Q3_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3d1926c9ab518c5c2debf9dad208a4c20c2f49bf34e06cbcb79f4b4d9e36564
3
+ size 3518987808
mistral-7b-instruct-v0.1.Q3_K_L.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad7675be40c656c8f4f1cd8ad1f4aa04fc145e468645402255d17d91ce7d7125
3
+ size 3822026272
mistral-7b-instruct-v0.1.Q3_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3d1926c9ab518c5c2debf9dad208a4c20c2f49bf34e06cbcb79f4b4d9e36564
3
+ size 3518987808
mistral-7b-instruct-v0.1.Q3_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a10a9f3a42271df1ed117f6cbba589f8a2c36dc4c8fee6e08d73bc653f78b81
3
+ size 3164569120
mistral-7b-instruct-v0.1.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5a7d4f43933ccf111c0a586ba027698e1d111173a595dd8e4bf28d00ae6cbeb
3
+ size 4108918304
mistral-7b-instruct-v0.1.Q4_1.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9cf789fd37e33e9f01e71cae50e1a814dd44569ddedee3ec6192d439d0365a61
3
+ size 4553317920
mistral-7b-instruct-v0.1.Q4_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afe690a8d8dd5021f0b3abc1aa25e3379197c8fd7b1c712b4dc64d4bf3106ecb
3
+ size 4368440864
mistral-7b-instruct-v0.1.Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afe690a8d8dd5021f0b3abc1aa25e3379197c8fd7b1c712b4dc64d4bf3106ecb
3
+ size 4368440864
mistral-7b-instruct-v0.1.Q4_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3bc7ba03de9880339b9d9a8d5152ccfe9328ad1d49ed3441e003088dac49b3e6
3
+ size 4140375584
mistral-7b-instruct-v0.1.Q5_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84a763fa1eae58959d60bb2f91180279540001e7cce22facfe991bf073d49ef0
3
+ size 4997717536
mistral-7b-instruct-v0.1.Q5_1.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba782381352b7a518f9d0b76bc7c9010a5428dbd135bca2c7dd19a734296a621
3
+ size 5442117152
mistral-7b-instruct-v0.1.Q5_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8df439e21b9680cb7668e4483eb165ff31d2f54b11a44f6206006877c80ee00
3
+ size 5131410976
mistral-7b-instruct-v0.1.Q5_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8df439e21b9680cb7668e4483eb165ff31d2f54b11a44f6206006877c80ee00
3
+ size 5131410976
mistral-7b-instruct-v0.1.Q5_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b44de61c1b7876a57269586ff79a387a88074a8100d9ff513b95a0222ceb4ac4
3
+ size 4997717536
mistral-7b-instruct-v0.1.Q6_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b833423c65b573fd0803ce2d47c315a344dd6bf2ce679692dbd3129583e38a1c
3
+ size 5942066720
mistral-7b-instruct-v0.1.Q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc3ee6009901673dedbd30430dc599495b55407f6c1ccaf0b434fa016640456e
3
+ size 7695859232