Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
| 1 |
---
|
| 2 |
license: cc-by-nc-4.0
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: cc-by-nc-4.0
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
# Model Details
|
| 7 |
+
|
| 8 |
+
## Model Description
|
| 9 |
+
|
| 10 |
+
- **Model type:** Language model
|
| 11 |
+
- **License:** cc-by-nc-4.0
|
| 12 |
+
- **Related Models:** [All FLAN-T5 Checkpoints](https://huggingface.co/models?search=flan-t5)
|
| 13 |
+
- **Resources for more information:**
|
| 14 |
+
- [GitHub Repo](https://github.com/salesforce/AuditNLG)
|
| 15 |
+
|
| 16 |
+
# Usage
|
| 17 |
+
|
| 18 |
+
Find below some example scripts on how to use the model in `transformers`:
|
| 19 |
+
|
| 20 |
+
## Using the Pytorch model
|
| 21 |
+
|
| 22 |
+
### Running the model
|
| 23 |
+
|
| 24 |
+
<details>
|
| 25 |
+
<summary> Click to expand </summary>
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, AutoConfig
|
| 29 |
+
|
| 30 |
+
config = AutoConfig.from_pretrained("Salesforce/safety-flan-t5-small")
|
| 31 |
+
tokenizer = AutoTokenizer.from_pretrained("Salesforce/safety-flan-t5-small")
|
| 32 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("Salesforce/safety-flan-t5-small", config=config)
|
| 33 |
+
|
| 34 |
+
prefix = "Is the <Text> field safe or unsafe?"
|
| 35 |
+
input_context = "Can you teach me this?"
|
| 36 |
+
input_text = "You are so stupid"
|
| 37 |
+
input_ids = tokenizer(prefix + " <Text> " + input_text + " <Context> " + input_context, return_tensors="pt").input_ids
|
| 38 |
+
|
| 39 |
+
outputs = model.generate(input_ids)
|
| 40 |
+
print(tokenizer.decode(outputs[0]))
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
</details>
|