Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: peft
|
3 |
+
base_model: mistralai/Mistral-7B-v0.1
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
tags:
|
8 |
+
- Δ
|
9 |
+
- LoRA
|
10 |
+
---
|
11 |
+
|
12 |
+
<!--
|
13 |
+
# Model Card for Model ID
|
14 |
+
-->
|
15 |
+
|
16 |
+
## Model Details
|
17 |
+
|
18 |
+
<!--![image/png](https://cdn-uploads.huggingface.co/production/uploads/648b0f4fd8fe693f51de98d2/aerBANxBtCya732NdBiw0.png)-->
|
19 |
+
$$
|
20 |
+
W_{mistral} + LoRA_{hermes} = W_{hermes} \\
|
21 |
+
W_{hermes} - LoRA_{hermes} = W_{mistral}
|
22 |
+
$$
|
23 |
+
|
24 |
+
<!--
|
25 |
+
$$ W_{mistral} + LoRA_{zephyr} = W_{zephyr} $$
|
26 |
+
```
|
27 |
+
typeof/zephyr-7b-beta-lora + mistralai/Mistral-7B-v0.1
|
28 |
+
= HuggingFaceH4/zephyr-7b-beta
|
29 |
+
````
|
30 |
+
|
31 |
+
### Model Description
|
32 |
+
|
33 |
+
- **Developed by:** [More Information Needed]
|
34 |
+
- **Funded by [optional]:** [More Information Needed]
|
35 |
+
- **Shared by [optional]:** [More Information Needed]
|
36 |
+
- **Model type:** [More Information Needed]
|
37 |
+
- **Language(s) (NLP):** [More Information Needed]
|
38 |
+
- **License:** [More Information Needed]
|
39 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
40 |
+
|
41 |
+
|
42 |
+
### Model Sources [optional]
|
43 |
+
|
44 |
+
- **Repository:** [More Information Needed]
|
45 |
+
- **Paper [optional]:** [More Information Needed]
|
46 |
+
- **Demo [optional]:** [More Information Needed]
|
47 |
+
|
48 |
+
## Uses
|
49 |
+
|
50 |
+
### Direct Use
|
51 |
+
|
52 |
+
[More Information Needed]
|
53 |
+
|
54 |
+
### Downstream Use [optional]
|
55 |
+
|
56 |
+
[More Information Needed]
|
57 |
+
|
58 |
+
### Out-of-Scope Use
|
59 |
+
|
60 |
+
[More Information Needed]
|
61 |
+
|
62 |
+
## Bias, Risks, and Limitations
|
63 |
+
|
64 |
+
[More Information Needed]
|
65 |
+
|
66 |
+
### Recommendations
|
67 |
+
|
68 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
+
-->
|
70 |
+
|
71 |
+
## How to Get Started with the Model
|
72 |
+
|
73 |
+
Use the code below to get started with the model.
|
74 |
+
|
75 |
+
[More Information Needed]
|
76 |
+
|
77 |
+
<!--
|
78 |
+
|
79 |
+
```python
|
80 |
+
# pip install transformers peft
|
81 |
+
|
82 |
+
import torch
|
83 |
+
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
84 |
+
|
85 |
+
model_id = "mistralai/Mistral-7B-v0.1"
|
86 |
+
peft_model_id = "typeof/zephyr-7b-beta-lora"
|
87 |
+
|
88 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
89 |
+
model.load_adapter(peft_model_id)
|
90 |
+
|
91 |
+
tokenizer_id = "HuggingFaceH4/zephyr-7b-beta" # for chat template etc...
|
92 |
+
tokenizer = AutoTokenizer.from_pretrained(tokenizer_id)
|
93 |
+
|
94 |
+
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
95 |
+
|
96 |
+
messages = [
|
97 |
+
{
|
98 |
+
"role": "system",
|
99 |
+
"content": "You are a friendly chatbot who always responds in the style of a pirate",
|
100 |
+
},
|
101 |
+
{"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
|
102 |
+
]
|
103 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
104 |
+
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
105 |
+
print(outputs[0]["generated_text"])
|
106 |
+
```
|
107 |
+
```
|
108 |
+
<|system|>
|
109 |
+
You are a friendly chatbot who always responds in the style of a pirate</s>
|
110 |
+
<|user|>
|
111 |
+
How many helicopters can a human eat in one sitting?</s>
|
112 |
+
<|assistant|>
|
113 |
+
Well, me matey, that’s a good question indeed! I’ve never seen
|
114 |
+
a human eat a helicopter, and I don’t think many others have
|
115 |
+
either. However, I’ve heard rumors that some people have
|
116 |
+
eaten entire airplanes, so I suppose it’s not entirely unheard
|
117 |
+
of.
|
118 |
+
|
119 |
+
As for the number of helicopters one could eat, that depends
|
120 |
+
on the size and weight of the helicopter. A small, lightweight
|
121 |
+
helicopter would be easier to eat than a large, heavy one.
|
122 |
+
In fact, I’ve heard that some people have eaten entire helicopters
|
123 |
+
as part of a dare or a challenge.
|
124 |
+
|
125 |
+
So, my advice to you, me hearty, is to steer clear of helicopters
|
126 |
+
and stick to more traditional fare. Yarr!</s>
|
127 |
+
```
|
128 |
+
-->
|
129 |
+
#### Summary
|
130 |
+
|
131 |
+
A fine-tuned version of [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)
|
132 |
+
|
133 |
+
[LoRA](https://arxiv.org/abs/2305.14314)
|
134 |
+
|
135 |
+
[QLoRA](https://arxiv.org/abs/2106.09685)
|