Update README.md
Browse files
README.md
CHANGED
|
@@ -3,4 +3,55 @@ license: apache-2.0
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
pipeline_tag: text-generation
|
| 6 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
pipeline_tag: text-generation
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
license: apache-2.0
|
| 11 |
+
language:
|
| 12 |
+
- en
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Model Card for Luna-standard-0.0.1
|
| 17 |
+
|
| 18 |
+
The Luna-standard-0.0.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.
|
| 19 |
+
|
| 20 |
+
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/).
|
| 21 |
+
|
| 22 |
+
## Instruction format
|
| 23 |
+
|
| 24 |
+
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.
|
| 25 |
+
|
| 26 |
+
E.g.
|
| 27 |
+
```
|
| 28 |
+
text = "<s>[INST] What is your favourite condiment? [/INST]"
|
| 29 |
+
"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> "
|
| 30 |
+
"[INST] Do you have mayonnaise recipes? [/INST]"
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method:
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 37 |
+
device = "cuda" # the device to load the model onto
|
| 38 |
+
model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
|
| 39 |
+
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
|
| 40 |
+
messages = [
|
| 41 |
+
{"role": "user", "content": "What is your favourite condiment?"},
|
| 42 |
+
{"role": "Luna", "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 |
+
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
|
| 46 |
+
model_inputs = encodeds.to(device)
|
| 47 |
+
model.to(device)
|
| 48 |
+
generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
|
| 49 |
+
decoded = tokenizer.batch_decode(generated_ids)
|
| 50 |
+
print(decoded[0])
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Model Architecture
|
| 54 |
+
This instruction model is based on Mistral-7B-v0.1, a transformer model with the following architecture choices:
|
| 55 |
+
- Grouped-Query Attention
|
| 56 |
+
- Sliding-Window Attention
|
| 57 |
+
- Byte-fallback BPE tokenizer
|