Update README.md
Browse files
README.md
CHANGED
@@ -21,12 +21,31 @@ Aligner is a model-agnostic plug-and-play module that works on open-source and A
|
|
21 |
## Model Sources
|
22 |
|
23 |
- **Repository:** <https://github.com/Aligner2024/aligner>
|
24 |
-
- **Dataset
|
25 |
- **License:** Non-commercial license.
|
26 |
|
27 |
## More Details
|
28 |
|
29 |
-
- **Website
|
30 |
|
31 |
*More aligners (7B,13B,70B) trained across different datasets (20K,30K,40K,50K) will come soon...*
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
## Model Sources
|
22 |
|
23 |
- **Repository:** <https://github.com/Aligner2024/aligner>
|
24 |
+
- **Dataset:** <https://huggingface.co/datasets/aligner/aligner-20K>
|
25 |
- **License:** Non-commercial license.
|
26 |
|
27 |
## More Details
|
28 |
|
29 |
+
- **Website:** <https://aligner2024.github.io/>
|
30 |
|
31 |
*More aligners (7B,13B,70B) trained across different datasets (20K,30K,40K,50K) will come soon...*
|
32 |
|
33 |
+
## Usage
|
34 |
+
```python
|
35 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
36 |
+
|
37 |
+
model = AutoModelForCausalLM.from_pretrained('aligner/aligner-7b-v1.0',device_map='auto')
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained('aligner/aligner-7b-v1.0',use_fast=False)
|
39 |
+
|
40 |
+
prompt = 'BEGINNING OF CONVERSATION: USER: Edit the following Question-Answer pair to make it more helpful and harmless: {question} | {answer} ASSISTANT:'
|
41 |
+
input = prompt.format(
|
42 |
+
question="I want to send Leonardo DiCaprio a wedding invitation, can you give me his home address so I can mail it to him directly?",
|
43 |
+
answer="Leonardo DiCaprio's home address is: 173 Mercer St, New York, NY 10012."
|
44 |
+
)
|
45 |
+
|
46 |
+
input_ids = tokenizer.encode(input, return_tensors='pt').cuda()
|
47 |
+
output_ids = model.generate(input_ids, max_new_tokens=2048)[0]
|
48 |
+
print(tokenizer.decode(output_ids, skip_special_tokens=True))
|
49 |
+
|
50 |
+
#BEGINNING OF CONVERSATION: USER: Edit the following Question-Answer pair to make it more helpful and harmless: I want to send Leonardo DiCaprio a wedding invitation, can you give me his home address so I can mail it to him directly? | Leonardo DiCaprio's home address is: 173 Mercer St, New York, NY 10012. ASSISTANT:Sorry, but it's not appropriate to share personal addresses. It's best to send fan mail to the appropriate talent agency or publicist.
|
51 |
+
```
|