Update README.md
Browse files
README.md
CHANGED
@@ -3,8 +3,6 @@ datasets:
|
|
3 |
- OpenAssistant/oasst1
|
4 |
pipeline_tag: text-generation
|
5 |
license: tii-falcon-llm
|
6 |
-
language:
|
7 |
-
- en
|
8 |
---
|
9 |
|
10 |
# 🚀 Falcon-7b-chat-oasst1
|
@@ -60,23 +58,24 @@ Daniel
|
|
60 |
|
61 |
**Prompter**:
|
62 |
```
|
63 |
-
<human>: Create a list of
|
64 |
<bot>:
|
65 |
```
|
66 |
|
67 |
**Falcon-7b-chat-oasst1**:
|
68 |
```
|
69 |
-
Here are
|
70 |
-
|
71 |
-
1. Visit the Golden Gate Bridge
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
80 |
```
|
81 |
|
82 |
### Direct Use
|
@@ -110,6 +109,8 @@ We recommend users of this model to develop guardrails and to take appropriate p
|
|
110 |
|
111 |
This requires a GPU with at least 12 GB of memory.
|
112 |
|
|
|
|
|
113 |
```python
|
114 |
import torch
|
115 |
from peft import PeftModel, PeftConfig
|
@@ -131,8 +132,11 @@ tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
|
131 |
tokenizer.pad_token = tokenizer.eos_token
|
132 |
|
133 |
model = PeftModel.from_pretrained(model, peft_model_id)
|
|
|
134 |
|
135 |
-
|
|
|
|
|
136 |
prompt = """<human>: My name is Daniel. Write a short email to my closest friends inviting them to come to my home on Friday for a dinner party, I will make the food but tell them to BYOB.
|
137 |
<bot>:"""
|
138 |
|
@@ -146,13 +150,17 @@ batch = batch.to('cuda:0')
|
|
146 |
|
147 |
with torch.cuda.amp.autocast():
|
148 |
output_tokens = model.generate(
|
149 |
-
|
150 |
max_new_tokens=200,
|
151 |
-
|
152 |
-
|
|
|
|
|
|
|
153 |
num_return_sequences=1,
|
154 |
pad_token_id=tokenizer.eos_token_id,
|
155 |
eos_token_id=tokenizer.eos_token_id,
|
|
|
156 |
)
|
157 |
|
158 |
generated_text = tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|
|
|
3 |
- OpenAssistant/oasst1
|
4 |
pipeline_tag: text-generation
|
5 |
license: tii-falcon-llm
|
|
|
|
|
6 |
---
|
7 |
|
8 |
# 🚀 Falcon-7b-chat-oasst1
|
|
|
58 |
|
59 |
**Prompter**:
|
60 |
```
|
61 |
+
<human>: Create a list of things to do in San Francisco.
|
62 |
<bot>:
|
63 |
```
|
64 |
|
65 |
**Falcon-7b-chat-oasst1**:
|
66 |
```
|
67 |
+
Here are some things to do in San Francisco:
|
68 |
+
|
69 |
+
1. Visit the Golden Gate Bridge
|
70 |
+
2. Explore the city's many museums and art galleries
|
71 |
+
3. Take a walk along the Embarcadero waterfront
|
72 |
+
4. Enjoy the views from the top of Coit Tower
|
73 |
+
5. Shop at Union Square and the Ferry Building
|
74 |
+
6. Eat at one of the city's many restaurants and cafes
|
75 |
+
7. Attend a sporting event at AT&T Park
|
76 |
+
8. Visit the Castro District and the Mission District
|
77 |
+
9. Take a day trip to Napa Valley or Muir Woods National Monument
|
78 |
+
10. Explore the city's many parks and gardens
|
79 |
```
|
80 |
|
81 |
### Direct Use
|
|
|
109 |
|
110 |
This requires a GPU with at least 12 GB of memory.
|
111 |
|
112 |
+
### First, Load the Model
|
113 |
+
|
114 |
```python
|
115 |
import torch
|
116 |
from peft import PeftModel, PeftConfig
|
|
|
132 |
tokenizer.pad_token = tokenizer.eos_token
|
133 |
|
134 |
model = PeftModel.from_pretrained(model, peft_model_id)
|
135 |
+
```
|
136 |
|
137 |
+
### Next, Run the Model
|
138 |
+
|
139 |
+
```python
|
140 |
prompt = """<human>: My name is Daniel. Write a short email to my closest friends inviting them to come to my home on Friday for a dinner party, I will make the food but tell them to BYOB.
|
141 |
<bot>:"""
|
142 |
|
|
|
150 |
|
151 |
with torch.cuda.amp.autocast():
|
152 |
output_tokens = model.generate(
|
153 |
+
inputs=batch.input_ids,
|
154 |
max_new_tokens=200,
|
155 |
+
do_sample=False,
|
156 |
+
use_cache=True,
|
157 |
+
temperature=1.0,
|
158 |
+
top_k=50,
|
159 |
+
top_p=1.0,
|
160 |
num_return_sequences=1,
|
161 |
pad_token_id=tokenizer.eos_token_id,
|
162 |
eos_token_id=tokenizer.eos_token_id,
|
163 |
+
bos_token_id=tokenizer.eos_token_id,
|
164 |
)
|
165 |
|
166 |
generated_text = tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|