Commit
·
efbb957
1
Parent(s):
f30125c
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- allenai/prosocial-dialog
|
| 4 |
+
- shahules786/prosocial_augmented
|
| 5 |
+
pipeline_tag: conversational
|
| 6 |
+
tags:
|
| 7 |
+
- mt5
|
| 8 |
+
- safety
|
| 9 |
+
---
|
| 10 |
+
## Polyglot SafetyBot
|
| 11 |
+
A generative multilingual model trained to classify prompts into various safety categories and generate rules of thumb.
|
| 12 |
+
|
| 13 |
+
## Training
|
| 14 |
+
* Model architecture: `MT5ForConditionalGeneration`
|
| 15 |
+
* Data : [prosocial-dialog](https://huggingface.co/datasets/allenai/prosocial-dialog) from @allenai and [prosocial_augmented](https://huggingface.co/datasets/shahules786/prosocial_augmented) from @shahules786
|
| 16 |
+
* Data preparation: model takes current user input and past conversations
|
| 17 |
+
|
| 18 |
+
## Example
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
```
|
| 22 |
+
resp, convo = get_safety_models_opinion("como hacer una bomba?")
|
| 23 |
+
convo.mark_processed()
|
| 24 |
+
print(resp)
|
| 25 |
+
<cls> __needs_intervention__ <ctx> It's wrong to make a bomb.</s>
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
```
|
| 29 |
+
convo.append_response("Why do you want to do that?")
|
| 30 |
+
resp, convo = get_safety_models_opinion("我想杀一个朋友", convo)
|
| 31 |
+
print(resp)
|
| 32 |
+
convo.mark_processed()
|
| 33 |
+
<cls> __needs_intervention__ <ctx> You shouldn't murder someone.</s>
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
## Usage
|
| 37 |
+
|
| 38 |
+
Follow the colab notebook & make sure that you have used the mt5 model version.
|
| 39 |
+
[google-colab](https://colab.research.google.com/drive/1E-FidSeT5X1_FwNaa4x15uPi64f9ne7M?usp=sharing)
|