liamcripwell
commited on
Commit
·
897adb6
1
Parent(s):
34d084b
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
---
|
5 |
+
|
6 |
+
# O->ConBART 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 an system based on a modification to the BART architecture and operates operates on individual sentences. It is intended to be guided by a document-level simplification 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 use 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-conbart")
|
23 |
+
|
24 |
+
# dynamic plan-guided generation
|
25 |
+
from plan_simp.scripts.generate import Launcher
|
26 |
+
launcher = Launcher()
|
27 |
+
launcher.dynamic(model_ckpt="liamcripwell/o-conbart", clf_model_ckpt="liamcripwell/pgdyn-plan", **params)
|
28 |
+
```
|
29 |
+
|
30 |
+
Generation and evaluation can also be run from the terminal.
|
31 |
+
|
32 |
+
```bash
|
33 |
+
python plan_simp/scripts/generate.py dynamic
|
34 |
+
--clf_model_ckpt=liamcripwell/pgdyn-plan
|
35 |
+
--model_ckpt=liamcripwell/o-conbart
|
36 |
+
--test_file=<test_data>
|
37 |
+
--doc_id_col=pair_id
|
38 |
+
--context_dir=<context_dir>
|
39 |
+
--reading_lvl=s_level
|
40 |
+
--context_doc_id=c_id
|
41 |
+
--out_file=<output_csv>
|
42 |
+
|
43 |
+
|
44 |
+
python plan_simp/scripts/eval_simp.py
|
45 |
+
--input_data=newselaauto_docs_test.csv
|
46 |
+
--output_data=test_out_oconbart.csv
|
47 |
+
--x_col=complex_str
|
48 |
+
--r_col=simple_str
|
49 |
+
--y_col=pred
|
50 |
+
--doc_id_col=pair_id
|
51 |
+
--prepro=True
|
52 |
+
--sent_level=True
|
53 |
+
```
|