mav23 commited on
Commit
b8e4ca3
·
verified ·
1 Parent(s): f405948

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.2.Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
37
+ mistral-7b-instruct-v0.2.Q3_K.gguf filter=lfs diff=lfs merge=lfs -text
38
+ mistral-7b-instruct-v0.2.Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
39
+ mistral-7b-instruct-v0.2.Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
40
+ mistral-7b-instruct-v0.2.Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
41
+ mistral-7b-instruct-v0.2.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
42
+ mistral-7b-instruct-v0.2.Q4_1.gguf filter=lfs diff=lfs merge=lfs -text
43
+ mistral-7b-instruct-v0.2.Q4_K.gguf filter=lfs diff=lfs merge=lfs -text
44
+ mistral-7b-instruct-v0.2.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
45
+ mistral-7b-instruct-v0.2.Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
46
+ mistral-7b-instruct-v0.2.Q5_0.gguf filter=lfs diff=lfs merge=lfs -text
47
+ mistral-7b-instruct-v0.2.Q5_1.gguf filter=lfs diff=lfs merge=lfs -text
48
+ mistral-7b-instruct-v0.2.Q5_K.gguf filter=lfs diff=lfs merge=lfs -text
49
+ mistral-7b-instruct-v0.2.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
50
+ mistral-7b-instruct-v0.2.Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
51
+ mistral-7b-instruct-v0.2.Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
52
+ mistral-7b-instruct-v0.2.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - finetuned
5
+ pipeline_tag: text-generation
6
+ new_version: mistralai/Mistral-7B-Instruct-v0.3
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.2
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.2")
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.2 Large Language Model (LLM) is an instruct fine-tuned version of the Mistral-7B-v0.2.
70
+
71
+ Mistral-7B-v0.2 has the following changes compared to Mistral-7B-v0.1
72
+ - 32k context window (vs 8k context in v0.1)
73
+ - Rope-theta = 1e6
74
+ - No Sliding-Window Attention
75
+
76
+ For full details of this model please read our [paper](https://arxiv.org/abs/2310.06825) and [release blog post](https://mistral.ai/news/la-plateforme/).
77
+
78
+ ## Instruction format
79
+
80
+ 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.
81
+
82
+ E.g.
83
+ ```
84
+ text = "<s>[INST] What is your favourite condiment? [/INST]"
85
+ "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> "
86
+ "[INST] Do you have mayonnaise recipes? [/INST]"
87
+ ```
88
+
89
+ This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method:
90
+
91
+ ```python
92
+ from transformers import AutoModelForCausalLM, AutoTokenizer
93
+
94
+ device = "cuda" # the device to load the model onto
95
+
96
+ model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
97
+ tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
98
+
99
+ messages = [
100
+ {"role": "user", "content": "What is your favourite condiment?"},
101
+ {"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!"},
102
+ {"role": "user", "content": "Do you have mayonnaise recipes?"}
103
+ ]
104
+
105
+ encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
106
+
107
+ model_inputs = encodeds.to(device)
108
+ model.to(device)
109
+
110
+ generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
111
+ decoded = tokenizer.batch_decode(generated_ids)
112
+ print(decoded[0])
113
+ ```
114
+
115
+ ## Troubleshooting
116
+ - If you see the following error:
117
+ ```
118
+ Traceback (most recent call last):
119
+ File "", line 1, in
120
+ File "/transformers/models/auto/auto_factory.py", line 482, in from_pretrained
121
+ config, kwargs = AutoConfig.from_pretrained(
122
+ File "/transformers/models/auto/configuration_auto.py", line 1022, in from_pretrained
123
+ config_class = CONFIG_MAPPING[config_dict["model_type"]]
124
+ File "/transformers/models/auto/configuration_auto.py", line 723, in getitem
125
+ raise KeyError(key)
126
+ KeyError: 'mistral'
127
+ ```
128
+
129
+ Installing transformers from source should solve the issue
130
+ pip install git+https://github.com/huggingface/transformers
131
+
132
+ This should not be required after transformers-v4.33.4.
133
+
134
+ ## Limitations
135
+
136
+ The Mistral 7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
137
+ It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
138
+ make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
139
+
140
+ ## The Mistral AI Team
141
+
142
+ 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,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MistralForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 1,
7
+ "eos_token_id": 2,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 4096,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 14336,
12
+ "max_position_embeddings": 32768,
13
+ "model_type": "mistral",
14
+ "num_attention_heads": 32,
15
+ "num_hidden_layers": 32,
16
+ "num_key_value_heads": 8,
17
+ "rms_norm_eps": 1e-05,
18
+ "rope_theta": 1000000.0,
19
+ "sliding_window": null,
20
+ "tie_word_embeddings": false,
21
+ "torch_dtype": "bfloat16",
22
+ "transformers_version": "4.36.0",
23
+ "use_cache": true,
24
+ "vocab_size": 32000
25
+ }
mistral-7b-instruct-v0.2.Q2_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b386c57f0681f6db069e0a495f6fa19e397d53b7a927200bf223b8383dca7c61
3
+ size 2719243488
mistral-7b-instruct-v0.2.Q3_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d520dd63c8b9dc9794218da7d2929545396fa1133974e5d8d2d6dec2252f3fe
3
+ size 3518987488
mistral-7b-instruct-v0.2.Q3_K_L.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a65b79663ef5f1086a1c77423198df584735b3947a3b40c577031f6006a60f8b
3
+ size 3822025952
mistral-7b-instruct-v0.2.Q3_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d520dd63c8b9dc9794218da7d2929545396fa1133974e5d8d2d6dec2252f3fe
3
+ size 3518987488
mistral-7b-instruct-v0.2.Q3_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:63dcec4b346fb439689664601574c12be95926016c7cadcdb91f39d4bc8d2dc7
3
+ size 3164568800
mistral-7b-instruct-v0.2.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54fc7d74a488ab3582b7197563de7e86fafe825d8de0e7115eb28c6d7463d84e
3
+ size 4108917984
mistral-7b-instruct-v0.2.Q4_1.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54aa6b575bd03f089b36614829b449092c629c012090a5111a18046819c37db2
3
+ size 4553317600
mistral-7b-instruct-v0.2.Q4_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2bf7873fe1b40ca42c6558319587b20e86bfaefa400daa31a8cd36b68c994ec6
3
+ size 4368440544
mistral-7b-instruct-v0.2.Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2bf7873fe1b40ca42c6558319587b20e86bfaefa400daa31a8cd36b68c994ec6
3
+ size 4368440544
mistral-7b-instruct-v0.2.Q4_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab38cdd642fe9786d2149ac5e23fb086ce477fc5b3be51379cffbc5594391247
3
+ size 4140375264
mistral-7b-instruct-v0.2.Q5_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f68785af812fb920ed4c9089a53424657405ab2c37b929947b114a7a0af07245
3
+ size 4997717216
mistral-7b-instruct-v0.2.Q5_1.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d013b6844bc8dc57ad732459156b604e24b93bd20743321dcf60f6ddc4e408b
3
+ size 5442116832
mistral-7b-instruct-v0.2.Q5_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c180118051d6e9b4cbda49bc672f51cce1bbdffb4fb8e7a6b437817d2ddff40c
3
+ size 5131410656
mistral-7b-instruct-v0.2.Q5_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c180118051d6e9b4cbda49bc672f51cce1bbdffb4fb8e7a6b437817d2ddff40c
3
+ size 5131410656
mistral-7b-instruct-v0.2.Q5_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b130ba94bdfec0e9177f6c21e507a0be2a7b31d971a28ecf305f09955602d0c
3
+ size 4997717216
mistral-7b-instruct-v0.2.Q6_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:329e118c733a4fecdc48bff86ee87fcf77bb5768daf8192e0fa9b3b445cd6aab
3
+ size 5942066400
mistral-7b-instruct-v0.2.Q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:28e690e4da7aa901ea011f46a4910eef378a74934ec8b5012dcba56bd4c1518a
3
+ size 7695858912