Update README.md
Browse files
README.md
CHANGED
@@ -5,8 +5,8 @@ base_model: mistralai/Mistral-7B-v0.1
|
|
5 |
|
6 |
# Model Card for Model ID
|
7 |
|
8 |
-
|
9 |
-
|
10 |
|
11 |
|
12 |
## Model Details
|
@@ -17,49 +17,33 @@ base_model: mistralai/Mistral-7B-v0.1
|
|
17 |
|
18 |
|
19 |
|
20 |
-
- **Developed by:**
|
21 |
-
- **
|
22 |
-
- **
|
23 |
-
- **
|
24 |
-
- **
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
-
|
28 |
-
### Model Sources [optional]
|
29 |
-
|
30 |
-
<!-- Provide the basic links for the model. -->
|
31 |
-
|
32 |
-
- **Repository:** [More Information Needed]
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
|
36 |
## Uses
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
### Direct Use
|
41 |
-
|
42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
-
|
46 |
-
### Downstream Use [optional]
|
47 |
-
|
48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
-
|
|
|
|
|
55 |
|
56 |
-
|
|
|
57 |
|
58 |
## Bias, Risks, and Limitations
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
|
64 |
### Recommendations
|
65 |
|
@@ -71,7 +55,42 @@ Users (both direct and downstream) should be made aware of the risks, biases and
|
|
71 |
|
72 |
Use the code below to get started with the model.
|
73 |
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
## Training Details
|
77 |
|
|
|
5 |
|
6 |
# Model Card for Model ID
|
7 |
|
8 |
+
LoRA model trained for ~11 hours on r/uwaterloo data.
|
9 |
+
Only trained on top-level comments with the most upvotes on each post.
|
10 |
|
11 |
|
12 |
## Model Details
|
|
|
17 |
|
18 |
|
19 |
|
20 |
+
- **Developed by:** Anthony Susevski and Alvin Li
|
21 |
+
- **Model type:** LoRA
|
22 |
+
- **Language(s) (NLP):** English
|
23 |
+
- **License:** mit
|
24 |
+
- **Finetuned from model [optional]:** mistralai/Mistral-7B-v0.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
## Uses
|
27 |
|
28 |
+
Pass a post title and a post text(optional) in the style of a Reddit post into the below prompt.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
```
|
31 |
+
prompt = f"""
|
32 |
+
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
33 |
+
|
34 |
+
### Instruction:
|
35 |
+
Respond to the reddit post in the style of a University of Waterloo student.
|
36 |
|
37 |
+
### Input:
|
38 |
+
{post_title}
|
39 |
+
{post_text}
|
40 |
|
41 |
+
### Response:
|
42 |
+
```
|
43 |
|
44 |
## Bias, Risks, and Limitations
|
45 |
|
46 |
+
No alignment training as of yet -- only SFT.
|
|
|
|
|
47 |
|
48 |
### Recommendations
|
49 |
|
|
|
55 |
|
56 |
Use the code below to get started with the model.
|
57 |
|
58 |
+
```
|
59 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
60 |
+
import torch
|
61 |
+
from peft import PeftModel, PeftConfig
|
62 |
+
|
63 |
+
peft_model_id = "asusevski/mistraloo-sft"
|
64 |
+
peft_config = PeftConfig.from_pretrained(peft_model_id)
|
65 |
+
model = AutoModelForCausalLM.from_pretrained(peft_config.base_model_name_or_path)
|
66 |
+
model = PeftModel.from_pretrained(model, peft_model_id).to(device)
|
67 |
+
model.eval()
|
68 |
+
|
69 |
+
|
70 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
71 |
+
peft_config.base_model_name_or_path,
|
72 |
+
add_bos_token=True
|
73 |
+
)
|
74 |
+
|
75 |
+
post_title = "my example post title"
|
76 |
+
post_text = "my example post text"
|
77 |
+
prompt = f"""
|
78 |
+
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
79 |
+
|
80 |
+
### Instruction:
|
81 |
+
Respond to the reddit post in the style of a University of Waterloo student.
|
82 |
+
|
83 |
+
### Input:
|
84 |
+
{post_title}
|
85 |
+
{post_text}
|
86 |
+
|
87 |
+
### Response:
|
88 |
+
"""
|
89 |
+
model_input = tokenizer(prompt, return_tensors="pt").to(device)
|
90 |
+
with torch.no_grad():
|
91 |
+
model_output = model.generate(**model_input, max_new_tokens=256, repetition_penalty=1.15)[0]
|
92 |
+
output = tokenizer.decode(model_output, skip_special_tokens=True)
|
93 |
+
```
|
94 |
|
95 |
## Training Details
|
96 |
|