liamcripwell
commited on
Commit
•
cae4db1
1
Parent(s):
3748f59
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
---
|
5 |
+
|
6 |
+
# O->LED_para document simplification system
|
7 |
+
|
8 |
+
This is a pretrained version of the document simplification model presented in the Findings of ACL 2023 paper ["Context-Aware Document Simplification"](https://arxiv.org/abs/2305.06274).
|
9 |
+
|
10 |
+
It is a system based on the [Longformer encoder-decoder](https://huggingface.co/allenai/led-base-16384) that operates at the paragraph-level and is intended to be guided by a planner.
|
11 |
+
|
12 |
+
Target reading levels (1-4) should be indicated via a control token prepended to each input sequence ("\<RL_1\>", "\<RL_2\>", "\<RL_3\>", "\<RL_4\>"). If using the terminal interface, this will be handled automatically.
|
13 |
+
|
14 |
+
## How to use
|
15 |
+
It is recommended to use the [plan_simp](https://github.com/liamcripwell/plan_simp/tree/main) library to interface with the model.
|
16 |
+
|
17 |
+
Here is how to load this model in PyTorch:
|
18 |
+
|
19 |
+
```python
|
20 |
+
from plan_simp.models.bart import load_simplifier
|
21 |
+
|
22 |
+
simplifier, tokenizer, hparams = load_simplifier("liamcripwell/o-ledpara")
|
23 |
+
```
|
24 |
+
|
25 |
+
Plan-guided generation and evaluation can be run from the terminal (see the repo for more details).
|
26 |
+
|
27 |
+
```bash
|
28 |
+
python doc_simp/scripts/generate.py dynamic
|
29 |
+
--clf_model_ckpt=liamcripwell/pgdyn-plan
|
30 |
+
--model_ckpt=liamcripwell/o-ledpara
|
31 |
+
--test_file=<test_data>
|
32 |
+
--doc_id_col=pair_id
|
33 |
+
--context_dir=<context_dir>
|
34 |
+
--out_file=<output_csv>
|
35 |
+
--reading_lvl=s_level
|
36 |
+
--context_doc_id=pair_id
|
37 |
+
--para_lvl=True
|
38 |
+
|
39 |
+
python plan_simp/scripts/eval_simp.py
|
40 |
+
--input_data=newselaauto_docs_test.csv
|
41 |
+
--output_data=test_out_oledpara.csv
|
42 |
+
--x_col=complex_str
|
43 |
+
--r_col=simple_str
|
44 |
+
--y_col=pred
|
45 |
+
--doc_id_col=pair_id
|
46 |
+
--prepro=True
|
47 |
+
--sent_level=True
|
48 |
+
```
|