Update README.md
Browse files
README.md
CHANGED
|
@@ -21,9 +21,15 @@ The model itself is [BART (base)](https://huggingface.co/facebook/bart-base) mod
|
|
| 21 |
```python
|
| 22 |
from transformers import BartForConditionalGeneration, AutoTokenizer
|
| 23 |
base_model_name = 'facebook/bart-base'
|
| 24 |
-
model_name = '
|
| 25 |
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
|
| 26 |
model = BartForConditionalGeneration.from_pretrained(model_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
```
|
| 28 |
|
| 29 |
**Citation**
|
|
|
|
| 21 |
```python
|
| 22 |
from transformers import BartForConditionalGeneration, AutoTokenizer
|
| 23 |
base_model_name = 'facebook/bart-base'
|
| 24 |
+
model_name = 's-nlp/bart-base-detox'
|
| 25 |
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
|
| 26 |
model = BartForConditionalGeneration.from_pretrained(model_name)
|
| 27 |
+
|
| 28 |
+
input_ids = tokenizer.encode('You are a complete idiot!', return_tensors='pt')
|
| 29 |
+
output_ids = model.generate(input_ids, max_length=50, num_return_sequences=1)
|
| 30 |
+
output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
| 31 |
+
print(output_text)
|
| 32 |
+
# You are unwise!
|
| 33 |
```
|
| 34 |
|
| 35 |
**Citation**
|