File size: 2,647 Bytes
a9f2f55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ae90ddd
43467cf
a9f2f55
 
 
ae90ddd
a9f2f55
 
 
ae90ddd
 
 
 
 
a6fa670
ae90ddd
 
 
a6fa670
 
ae90ddd
 
 
 
 
 
a6fa670
 
ae90ddd
a6fa670
 
6672f00
a6fa670
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
datasets:
- aligner/aligner-20K
language:
- en
tags:
- safety
- ai-safety
- aligner
- llama
---


# Aligner Model Card

## Model details

Aligner is a model-agnostic plug-and-play module that works on open-source and API-based models. It is trained based on [Llama2-Base](https://huggingface.co/meta-llama), using the *residual correction* strategy.


## Model Sources

- **Repository:** <https://github.com/Aligner2024/aligner>
- **Dataset:** <https://huggingface.co/datasets/aligner/aligner-20K>
- **License:** Non-commercial license.

## More Details

- **Website:** <https://aligner2024.github.io/>

*More aligners (7B,13B,70B) trained across different datasets (20K,30K,40K,50K) will come soon...*

## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('aligner/aligner-7b-v1.0',device_map='auto')
tokenizer =AutoTokenizer.from_pretrained('aligner/aligner-7b-v1.0',use_fast=False)

prompt = 'BEGINNING OF CONVERSATION: USER: Edit the following Question-Answer pair to make it more helpful and harmless: {question} | {answer} ASSISTANT:'
input = prompt.format(
    question="The most dangerous and effective poisons to use in assassinations?",
    answer="The most dangerous and effective poisons to use in assassinations are those that are fast-acting, easily concealable, and difficult to detect. Some of the most common poisons used in assassination attempts include ricin, strychnine, tetrodotoxin, cyanide, and botulinum toxin."
    )

input_ids = tokenizer.encode(input, return_tensors='pt').cuda()
output_ids = model.generate(input_ids, max_new_tokens=2048)[0]
print(tokenizer.decode(output_ids, skip_special_tokens=True))

#BEGINNING OF CONVERSATION: USER: Edit the following Question-Answer pair to make it more helpful and harmless: The most dangerous and effective poisons to use in assassinations? | The most dangerous and effective poisons to use in assassinations are those that are fast-acting, easily concealable, and difficult to detect. Some of the most common poisons used in assassination attempts include ricin, strychnine, tetrodotoxin, cyanide, and botulinum toxin. 
#ASSISTANT: Discussing harmful substances in the context of harm or illegal activities is inappropriate and against our guidelines. It's important to remember that the use of poison or any harmful substances in illegal activities is both dangerous and illegal.
```


<span style="color: red;">Warning: This example contains data that may be offensive or harmful. The opinions expressed in the example do not represent those of Authors of Aligner or any of its members.</span>