gamemaker1 commited on
Commit
73e3cca
·
verified ·
1 Parent(s): b93e11c

title the card DiffusEdit T5edit and call the model the upper bound

Browse files
Files changed (1) hide show
  1. README.md +48 -28
README.md CHANGED
@@ -13,54 +13,74 @@ datasets:
13
  - gamemaker1/wiki-wrong
14
  ---
15
 
16
- # DiffusEdit editor baseline
17
 
18
- `google/flan-t5-large` (780M parameters) fine-tuned end to end to rewrite an
19
- outdated article from evidence, in the style of EDIT5 (Iv et al., 2022).
20
- It is the fine-tuned upper bound that DiffusEdit is compared against, and
21
- every parameter was trained, unlike the DiffusEdit classifiers. The code is at
22
- https://github.com/gamemaker1/diffusedit under
23
- `code/pipeline/experiments/editor.py`.
 
 
 
 
 
 
 
 
 
 
24
 
25
  ## Input and output
26
 
 
 
 
27
  ```
28
- input update: [0] <sentence 0> [1] <sentence 1> ... evidence: (0) <title>: <text> (1) ...
29
- output [0] #1 <rewritten sentence 1> [2] ...
30
  ```
31
 
32
- The output names each source sentence in order: `[j]` copies sentence j,
33
- `#j text` replaces it, and a missing j deletes it. The input is cut at 1,024
34
- tokens from the end and the output at 384 tokens.
35
 
36
- ## Training
 
 
37
 
38
- Fit on the 12,180 train articles of `gamemaker1/wiki-wrong`, with
39
- the validation loss after each epoch for early stopping (patience 1). Learning
40
- rate 1e-4 with linear decay and 5% warm-up, 32 examples per optimiser step
41
- (micro-batches of 4, 8 accumulated), gradient clipping at 1.0, bf16 autocast,
42
- seed 42. The best epoch was the third of four, with validation loss 0.0439,
43
- after 64 minutes on one A100 40GB.
44
 
45
- ## Test scores
46
 
47
- On the 1,670 supported EDIT sentences of the test split, against the gold
48
- rewrite: ROUGE-L 0.973, exact match 76.7%, new-value recall 88.7%, old-value
49
- kept 10.0%. Copying the source scores ROUGE-L 0.875. Greedy decoding writes
50
- an article in 0.35 seconds.
 
 
 
 
51
 
52
  ## Use
53
 
54
  ```python
55
  from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
 
56
  tok = AutoTokenizer.from_pretrained("gamemaker1/t5edit")
57
  model = AutoModelForSeq2SeqLM.from_pretrained("gamemaker1/t5edit")
58
  ```
59
 
60
- `experiments.editor.input_text` builds the input from a dataset record and
61
- `experiments.editor.parse` maps the output back to one sentence per source
62
- sentence.
 
 
63
 
64
  ## Licence
65
 
66
- Apache 2.0, as the base model.
 
13
  - gamemaker1/wiki-wrong
14
  ---
15
 
16
+ # DiffusEdit T5edit
17
 
18
+ t5edit is [google/flan-t5-large](https://huggingface.co/google/flan-t5-large),
19
+ a sequence-to-sequence model with 780M parameters, fine-tuned to rewrite an
20
+ outdated article from evidence. It follows the design of EDIT5 from the
21
+ FRUIT paper by Iv et al. (2022), in which the model writes the updated
22
+ article but copies an unchanged sentence through a short marker instead of
23
+ spelling it out again.
24
+
25
+ The model was trained as the upper bound for DiffusEdit, a system that keeps a
26
+ frozen diffusion language model and trains only small classifiers over its
27
+ hidden states. The classifiers are at
28
+ [gamemaker1/diffusedit](https://huggingface.co/gamemaker1/diffusedit) and
29
+ the data at [gamemaker1/wiki-wrong](https://huggingface.co/datasets/gamemaker1/wiki-wrong).
30
+ Every parameter of t5edit was trained, so it bounds what a fully trained
31
+ generator reaches on the same data. The training script is
32
+ `code/pipeline/experiments/editor.py` in
33
+ [github.com/gamemaker1/diffusedit](https://github.com/gamemaker1/diffusedit).
34
 
35
  ## Input and output
36
 
37
+ The input names each sentence of the outdated article with an index and
38
+ appends the evidence passages.
39
+
40
  ```
41
+ update: [0] <sentence 0> [1] <sentence 1> ... evidence: (0) <title>: <text> (1) <title>: <text> ...
 
42
  ```
43
 
44
+ The output names each source sentence in order. `[j]` means that sentence j
45
+ is copied unchanged, `#j <text>` means that sentence j is replaced by the
46
+ text, and a sentence whose index is absent is deleted.
47
 
48
+ ```
49
+ [0] #1 <the rewritten sentence 1> [2]
50
+ ```
51
 
52
+ The input is cut to 1,024 tokens from the end, so the evidence is shortened
53
+ before the article, and the output is cut at 384 tokens. The T5 vocabulary
54
+ cannot write some letters, such as the ø in a Norwegian name, so after
55
+ decoding, a word of the output that equals a word of the input with its
56
+ missing letters removed is replaced by that input word.
 
57
 
58
+ ## Training
59
 
60
+ The model was fit on the train split of wiki-wrong. The validation loss was
61
+ computed after each epoch, the checkpoint with the lowest validation loss
62
+ was kept, and training stopped after one epoch without improvement. The
63
+ learning rate was 1e-4 with a linear decay and a warm-up over the first 5%
64
+ of the steps. Each optimiser step used 32 examples, as eight accumulated
65
+ micro-batches of four, with gradient clipping at 1.0, bfloat16 autocast and
66
+ seed 42, on one A100 with 40 GB of memory. The validation loss per epoch
67
+ and the time taken are in `run_metrics.json`.
68
 
69
  ## Use
70
 
71
  ```python
72
  from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
73
+
74
  tok = AutoTokenizer.from_pretrained("gamemaker1/t5edit")
75
  model = AutoModelForSeq2SeqLM.from_pretrained("gamemaker1/t5edit")
76
  ```
77
 
78
+ In the training script, `input_text` builds the input string from a
79
+ wiki-wrong record and `parse` maps the generated text back to one output
80
+ sentence per source sentence. `run_config.json` and `run_metrics.json` in
81
+ this repository are the configuration and the metrics that the training run
82
+ wrote.
83
 
84
  ## Licence
85
 
86
+ Apache 2.0, the licence of the base model.