SamSJackson
commited on
Commit
•
c2f89a4
1
Parent(s):
53ebdcf
Update README.md
Browse files
README.md
CHANGED
@@ -1,13 +1,23 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
tags:
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
# Model Card for Model ID
|
7 |
|
8 |
-
|
|
|
9 |
|
|
|
|
|
10 |
|
|
|
|
|
|
|
|
|
11 |
|
12 |
## Model Details
|
13 |
|
@@ -17,185 +27,138 @@ tags: []
|
|
17 |
|
18 |
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
19 |
|
20 |
-
- **Developed by:**
|
21 |
-
- **
|
22 |
-
- **
|
23 |
-
- **
|
24 |
-
- **
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
### Model Sources [optional]
|
29 |
|
30 |
<!-- Provide the basic links for the model. -->
|
31 |
|
32 |
-
- **Repository:** [
|
33 |
-
- **Paper [optional]:** [
|
|
|
34 |
- **Demo [optional]:** [More Information Needed]
|
35 |
|
36 |
## Uses
|
37 |
|
38 |
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
|
|
|
|
39 |
|
40 |
-
|
41 |
|
42 |
-
|
43 |
|
44 |
-
|
45 |
|
46 |
### Downstream Use [optional]
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
### Out-of-Scope Use
|
53 |
-
|
54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
-
|
58 |
-
## Bias, Risks, and Limitations
|
59 |
-
|
60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
|
64 |
### Recommendations
|
65 |
|
66 |
-
|
67 |
|
68 |
-
|
|
|
69 |
|
70 |
## How to Get Started with the Model
|
71 |
|
72 |
Use the code below to get started with the model.
|
73 |
|
74 |
-
[More Information Needed]
|
75 |
-
|
76 |
## Training Details
|
77 |
|
78 |
### Training Data
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
|
84 |
-
|
|
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
|
|
|
92 |
|
93 |
#### Training Hyperparameters
|
94 |
|
95 |
-
- **Training regime:**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
#### Speeds, Sizes, Times [optional]
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
[More Information Needed]
|
102 |
-
|
103 |
-
## Evaluation
|
104 |
-
|
105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
|
121 |
-
|
122 |
|
123 |
-
|
|
|
|
|
124 |
|
125 |
-
|
126 |
|
127 |
-
|
128 |
|
129 |
-
|
|
|
130 |
|
131 |
-
|
132 |
|
|
|
|
|
133 |
|
|
|
134 |
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
-
|
|
|
140 |
|
141 |
-
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
|
171 |
## Citation [optional]
|
172 |
|
173 |
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
|
175 |
**BibTeX:**
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
|
197 |
## Model Card Contact
|
198 |
|
199 |
-
|
200 |
-
|
201 |
-
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
tags:
|
4 |
+
- paraphraser
|
5 |
+
license: mit
|
6 |
+
pipeline_tag: summarization
|
7 |
---
|
8 |
|
9 |
# Model Card for Model ID
|
10 |
|
11 |
+
[Paraphrasing evades detectors of AI-generated text,
|
12 |
+
but retrieval is an effective defense](https://arxiv.org/pdf/2303.13408.pdf) proposed a strong discourse paraphraser known as DIPPER.
|
13 |
|
14 |
+
DIPPER is a large model, built from [google/t5-efficient-xxl](https://huggingface.co/google/t5-efficient-xxl) and finetuned on 6.3M datapoints.
|
15 |
+
I am proposing a lightweight, non-context equivalent for lower-cost usage.
|
16 |
|
17 |
+
This model is built from [google/t5-large-nl32](https://huggingface.co/google/t5-efficient-large-nl32) and finetuned on 100,000 datapoints.
|
18 |
+
Notably, the datapoints are all non-context. Refer to the original paper if you wish for further understanding on this topic.
|
19 |
+
|
20 |
+
The dataset used to finetune this model is available here: [Dataset](https://huggingface.co/datasets/SamSJackson/kpar3-no-ctx)
|
21 |
|
22 |
## Model Details
|
23 |
|
|
|
27 |
|
28 |
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
29 |
|
30 |
+
- **Developed by:** Sam Jackson
|
31 |
+
- **Model type:** Sequence-to-Sequence Model
|
32 |
+
- **Language(s) (NLP):** English
|
33 |
+
- **License:** MIT
|
34 |
+
- **Finetuned from model [optional]:** [google/t5-large-nl32](https://huggingface.co/google/t5-efficient-large-nl32)
|
|
|
|
|
35 |
|
36 |
### Model Sources [optional]
|
37 |
|
38 |
<!-- Provide the basic links for the model. -->
|
39 |
|
40 |
+
- **Repository:** [Original Github](https://github.com/martiansideofthemoon/ai-detection-paraphrases)
|
41 |
+
- **Paper [optional]:** [Paraphrasing evades detectors of AI-generated text,
|
42 |
+
but retrieval is an effective defense](https://arxiv.org/pdf/2303.13408.pdf)
|
43 |
- **Demo [optional]:** [More Information Needed]
|
44 |
|
45 |
## Uses
|
46 |
|
47 |
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
48 |
+
The model is intended to be used for paraphrasing with notions of control.
|
49 |
+
The dataset used encourages lexical (word) and order (paragraph structure) parameters, which control the degree of strength in paraphrasing.
|
50 |
|
51 |
+
See the example code usage for a further understanding.
|
52 |
|
53 |
+
### Direct Use
|
54 |
|
55 |
+
The model is entirely usable from the uploaded state. No further finetuning is required, although possible.
|
56 |
|
57 |
### Downstream Use [optional]
|
58 |
|
59 |
+
This model was finetuned from a T5 checkpoint.
|
60 |
+
It is possible to further finetune this model, if desired.
|
61 |
+
If you plan for transfer learning, I would simply recommend starting from the initial checkpoint model: [google/t5-large-nl32](https://huggingface.co/google/t5-efficient-large-nl32).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
### Recommendations
|
64 |
|
65 |
+
In terms of recommendation, if you have the capacity, I would recommend using the more powerful model: [DIPPER](https://github.com/martiansideofthemoon/ai-detection-paraphrases)
|
66 |
|
67 |
+
Otherwise, this model is sufficiently strong.
|
68 |
+
It outperforms the sentence-based paraphraser [ChatGPT Paraphraser](https://huggingface.co/humarin/chatgpt_paraphraser_on_T5_base) when it comes to perplexity scores - when both models are compared using the facebook/opt-2.7b model.
|
69 |
|
70 |
## How to Get Started with the Model
|
71 |
|
72 |
Use the code below to get started with the model.
|
73 |
|
|
|
|
|
74 |
## Training Details
|
75 |
|
76 |
### Training Data
|
77 |
|
78 |
+
As mentioned, the training data is here: [kpar3-no-ctx](https://huggingface.co/datasets/SamSJackson/kpar3-no-ctx)
|
79 |
+
Pre-processing simply contains tokenisation through the google/t5-efficient-large-nl32 tokenizer.
|
|
|
80 |
|
81 |
+
The data is classic paraphrase pairs. However, the first element in the pair has terms "lexical = x" and "order = y".
|
82 |
+
The values x and y are in the set {0, 20, 40, 60, 80, 100} and denote the strength with which the model should paraphrase.
|
83 |
|
84 |
+
In particular, a sentence with "lexical = 0" should change as many words as possible, while maintaining the original meaning.
|
85 |
+
Meanwhile, a sentence with "order = 0" should restructure the paragraph to the model's greatest extent.
|
|
|
|
|
|
|
86 |
|
87 |
+
The dataset only contains parameter values in increments of 20.
|
88 |
|
89 |
#### Training Hyperparameters
|
90 |
|
91 |
+
- **Training regime:** <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
92 |
+
```python
|
93 |
+
learning_rate = 1e-4
|
94 |
+
bf16 = True
|
95 |
+
num_train_epochs = 2
|
96 |
+
auto_find_batch_size = True,
|
97 |
+
generation_num_beams = 2,
|
98 |
+
generation_max_length = 200
|
99 |
+
```
|
100 |
|
101 |
#### Speeds, Sizes, Times [optional]
|
102 |
|
103 |
+
Finetuning on 100,000 datapoints, this took around 14 GPU hours using a GTX 3090.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
+
### Example Usage
|
106 |
|
107 |
+
```python
|
108 |
+
import torch
|
109 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
110 |
|
111 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
112 |
|
113 |
+
tokenizer = AutoTokenizer.from_pretrained("google/t5-efficient-large-nl32")
|
114 |
|
115 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("SamSJackson/paraphrase-dipper-no-ctx")
|
116 |
+
model = model.to(device)
|
117 |
|
118 |
+
text = "Each Wednesdsay, I take my dog for a walk in Central Park."
|
119 |
|
120 |
+
lexical = 20
|
121 |
+
order = 40
|
122 |
|
123 |
+
prompt = f"lexical = {lexical}, order = {order} {text}"
|
124 |
|
125 |
+
input_ids = tokenizer(
|
126 |
+
prompt,
|
127 |
+
return_tensors='pt',
|
128 |
+
padding="longest",
|
129 |
+
max_length=1000,
|
130 |
+
truncation=True,
|
131 |
+
).to(device)
|
132 |
|
133 |
+
outputs = model.generate(
|
134 |
+
**input_ids,
|
135 |
+
top_p=0.75,
|
136 |
+
do_sample=True,
|
137 |
+
max_new_tokens=300,
|
138 |
+
)
|
139 |
|
140 |
+
response = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
141 |
+
response = f"{' '.join(response)}"
|
142 |
|
143 |
+
print(response)
|
144 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
|
146 |
## Citation [optional]
|
147 |
|
148 |
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
149 |
|
150 |
**BibTeX:**
|
151 |
+
```
|
152 |
+
@misc{krishna2023paraphrasing,
|
153 |
+
title={Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defense},
|
154 |
+
author={Kalpesh Krishna and Yixiao Song and Marzena Karpinska and John Wieting and Mohit Iyyer},
|
155 |
+
year={2023},
|
156 |
+
eprint={2303.13408},
|
157 |
+
archivePrefix={arXiv},
|
158 |
+
primaryClass={cs.CL}
|
159 |
+
}
|
160 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
## Model Card Contact
|
163 |
|
164 |
+
Contact me through huggingface if you have any questions.
|
|
|
|