jasonwu commited on
Commit
396352c
1 Parent(s): 795c3f1

Update README.md

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