lodrick-the-lafted
commited on
Commit
•
cfa7fff
1
Parent(s):
0333ebf
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- lodrick-the-lafted/Hermes-217K
|
5 |
+
---
|
6 |
+
|
7 |
+
<img src=https://huggingface.co/lodrick-the-lafted/Hermes-Instruct-217K/resolve/main/hermes-instruct.png>
|
8 |
+
|
9 |
+
# Hermes-Instruct-7B-217K
|
10 |
+
|
11 |
+
[Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) trained with 217K rows of [teknium/openhermes](https://huggingface.co/datasets/teknium/openhermes), in Alpaca format.
|
12 |
+
Why? Mistral-7B-Instruct-v0.2 has native 32K context and rope theta of 1M. It's not a base model, so I've used the same recipe with different amounts of data to gauge the effects of further finetuning.
|
13 |
+
|
14 |
+
<br />
|
15 |
+
<br />
|
16 |
+
|
17 |
+
# Prompt Format
|
18 |
+
|
19 |
+
Both the default Mistral-Instruct tags and Alpaca are fine, so either:
|
20 |
+
```
|
21 |
+
<s>[INST] {sys_prompt} {instruction} [/INST]
|
22 |
+
```
|
23 |
+
|
24 |
+
or
|
25 |
+
|
26 |
+
|
27 |
+
```
|
28 |
+
{sys_prompt}
|
29 |
+
|
30 |
+
### Instruction:
|
31 |
+
{instruction}
|
32 |
+
|
33 |
+
### Response:
|
34 |
+
|
35 |
+
```
|
36 |
+
The tokenizer default is Alpaca this time around.
|
37 |
+
|
38 |
+
<br />
|
39 |
+
<br />
|
40 |
+
|
41 |
+
# Usage
|
42 |
+
|
43 |
+
```python
|
44 |
+
from transformers import AutoTokenizer
|
45 |
+
import transformers
|
46 |
+
import torch
|
47 |
+
|
48 |
+
model = "lodrick-the-lafted/Hermes-Instruct-7B-217K"
|
49 |
+
|
50 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
51 |
+
pipeline = transformers.pipeline(
|
52 |
+
"text-generation",
|
53 |
+
model=model,
|
54 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
55 |
+
)
|
56 |
+
|
57 |
+
messages = [{"role": "user", "content": "Give me a cooking recipe for an apple pie."}]
|
58 |
+
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
59 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_p=0.95)
|
60 |
+
print(outputs[0]["generated_text"])
|
61 |
+
```
|
62 |
+
|