ichetandhembre
commited on
Commit
•
6b8a163
1
Parent(s):
9364246
Update README.md
Browse files
README.md
CHANGED
@@ -1,24 +1,89 @@
|
|
1 |
---
|
2 |
-
language:
|
3 |
-
- en
|
4 |
license: apache-2.0
|
5 |
pipeline_tag: text-generation
|
6 |
tags:
|
7 |
- finetuned
|
8 |
inference: true
|
9 |
-
base_model: unsloth/mistral-7b-bnb-4bit
|
10 |
widget:
|
11 |
- messages:
|
12 |
-
- role:
|
13 |
-
content:
|
14 |
---
|
15 |
|
16 |
-
#
|
17 |
|
18 |
-
-
|
19 |
-
- **License:** apache-2.0
|
20 |
-
- **Finetuned from model :** unsloth/mistral-7b-bnb-4bit
|
21 |
|
22 |
-
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
pipeline_tag: text-generation
|
4 |
tags:
|
5 |
- finetuned
|
6 |
inference: true
|
|
|
7 |
widget:
|
8 |
- messages:
|
9 |
+
- role: user
|
10 |
+
content: What is your favorite condiment?
|
11 |
---
|
12 |
|
13 |
+
# Model Card for Mistral-7B-Instruct-v0.2
|
14 |
|
15 |
+
The Mistral-7B-Instruct-v0.2 Large Language Model (LLM) is an improved instruct fine-tuned version of [Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1).
|
|
|
|
|
16 |
|
17 |
+
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/).
|
18 |
|
19 |
+
## Instruction format
|
20 |
+
|
21 |
+
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.
|
22 |
+
|
23 |
+
E.g.
|
24 |
+
```
|
25 |
+
text = "<s>[INST] What is your favourite condiment? [/INST]"
|
26 |
+
"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> "
|
27 |
+
"[INST] Do you have mayonnaise recipes? [/INST]"
|
28 |
+
```
|
29 |
+
|
30 |
+
This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method:
|
31 |
+
|
32 |
+
```python
|
33 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
34 |
+
|
35 |
+
device = "cuda" # the device to load the model onto
|
36 |
+
|
37 |
+
model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
|
39 |
+
|
40 |
+
messages = [
|
41 |
+
{"role": "user", "content": "What is your favourite condiment?"},
|
42 |
+
{"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!"},
|
43 |
+
{"role": "user", "content": "Do you have mayonnaise recipes?"}
|
44 |
+
]
|
45 |
+
|
46 |
+
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
|
47 |
+
|
48 |
+
model_inputs = encodeds.to(device)
|
49 |
+
model.to(device)
|
50 |
+
|
51 |
+
generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
|
52 |
+
decoded = tokenizer.batch_decode(generated_ids)
|
53 |
+
print(decoded[0])
|
54 |
+
```
|
55 |
+
|
56 |
+
## Model Architecture
|
57 |
+
This instruction model is based on Mistral-7B-v0.1, a transformer model with the following architecture choices:
|
58 |
+
- Grouped-Query Attention
|
59 |
+
- Sliding-Window Attention
|
60 |
+
- Byte-fallback BPE tokenizer
|
61 |
+
|
62 |
+
## Troubleshooting
|
63 |
+
- If you see the following error:
|
64 |
+
```
|
65 |
+
Traceback (most recent call last):
|
66 |
+
File "", line 1, in
|
67 |
+
File "/transformers/models/auto/auto_factory.py", line 482, in from_pretrained
|
68 |
+
config, kwargs = AutoConfig.from_pretrained(
|
69 |
+
File "/transformers/models/auto/configuration_auto.py", line 1022, in from_pretrained
|
70 |
+
config_class = CONFIG_MAPPING[config_dict["model_type"]]
|
71 |
+
File "/transformers/models/auto/configuration_auto.py", line 723, in getitem
|
72 |
+
raise KeyError(key)
|
73 |
+
KeyError: 'mistral'
|
74 |
+
```
|
75 |
+
|
76 |
+
Installing transformers from source should solve the issue
|
77 |
+
pip install git+https://github.com/huggingface/transformers
|
78 |
+
|
79 |
+
This should not be required after transformers-v4.33.4.
|
80 |
+
|
81 |
+
## Limitations
|
82 |
+
|
83 |
+
The Mistral 7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
|
84 |
+
It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
|
85 |
+
make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
|
86 |
+
|
87 |
+
## The Mistral AI Team
|
88 |
+
|
89 |
+
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.
|