tongshuangwu
commited on
Commit
•
d6cdf3a
1
Parent(s):
360d885
readme
Browse files
README.md
CHANGED
@@ -3,7 +3,7 @@ language: "en"
|
|
3 |
tags:
|
4 |
- counterfactual generation
|
5 |
widget:
|
6 |
-
- text: "It is great for kids.
|
7 |
---
|
8 |
|
9 |
# Polyjuice
|
@@ -21,8 +21,8 @@ tokenizer = AutoTokenizer.from_pretrained("uw-hai/polyjuice")
|
|
21 |
model = AutoModelWithLMHead.from_pretrained("uw-hai/polyjuice")
|
22 |
|
23 |
|
24 |
-
prompt_text = "A dog is embraced by the woman.
|
25 |
-
# or try: "A dog is embraced by the woman.
|
26 |
perturb_tok, end_tok = "<|perturb|>", "<|endoftext|>"
|
27 |
encoded_prompt = tokenizer.encode(prompt_text, add_special_tokens=False, return_tensors="pt")
|
28 |
input_ids = encoded_prompt
|
|
|
3 |
tags:
|
4 |
- counterfactual generation
|
5 |
widget:
|
6 |
+
- text: "It is great for kids. <|perturb|> [negation] It [BLANK] great for kids. [SEP]"
|
7 |
---
|
8 |
|
9 |
# Polyjuice
|
|
|
21 |
model = AutoModelWithLMHead.from_pretrained("uw-hai/polyjuice")
|
22 |
|
23 |
|
24 |
+
prompt_text = "A dog is embraced by the woman. <|perturb|> [negation] A dog is [BLANK] the woman."
|
25 |
+
# or try: "A dog is embraced by the woman. <|perturb|> [restructure] A dog is [BLANK] the woman."
|
26 |
perturb_tok, end_tok = "<|perturb|>", "<|endoftext|>"
|
27 |
encoded_prompt = tokenizer.encode(prompt_text, add_special_tokens=False, return_tensors="pt")
|
28 |
input_ids = encoded_prompt
|