liamcripwell
commited on
Commit
•
916ff14
1
Parent(s):
841317d
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
---
|
5 |
+
|
6 |
+
# pgdyn-plan
|
7 |
+
|
8 |
+
This is a pretrained model for the simplification component of the PG_Dyn system, described in the EACL 2023 paper "Document-Level Planning for Text Simplification".
|
9 |
+
It is the be used in conjunction with [the planning component](https://huggingface.co/liamcripwell/pgdyn-plan) to form the full pipeline.
|
10 |
+
The code [in this repo](https://github.com/liamcripwell/plan_simp) should be used.
|
11 |
+
|
12 |
+
## How to use
|
13 |
+
|
14 |
+
Here is how to load this model in PyTorch:
|
15 |
+
|
16 |
+
```python
|
17 |
+
from plan_simp.models.classifier import load_planner
|
18 |
+
from plan_simp.models.bart import load_simplifier
|
19 |
+
|
20 |
+
# contextual simplification planner
|
21 |
+
planner, p_tokenizer, p_hparams = load_planner("liamcripwell/pgdyn-plan")
|
22 |
+
|
23 |
+
# simplification model
|
24 |
+
simplifier, tokenizer, hparams = load_simplifier("liamcripwell/pgdyn-simp")
|
25 |
+
```
|
26 |
+
|
27 |
+
To perform end-to-end planning+simplification with dynamic document context, use the commands below. This assumed data is in a `.csv` format and context representations have been generated for each input document.
|
28 |
+
|
29 |
+
```bash
|
30 |
+
# using planner
|
31 |
+
python plan_simp/scripts/generate.py dynamic
|
32 |
+
--clf_model_ckpt=<planner_model> # e.g. liamcripwell/pgdyn-plan
|
33 |
+
--model_ckpt=<simplification_model> # e.g. liamcripwell/pgdyn-simp
|
34 |
+
--test_file=<test_sentences>
|
35 |
+
--doc_id_col=pair_id # document identifier for each sentence
|
36 |
+
--context_doc_id=c_id
|
37 |
+
--context_dir=<context_dir>
|
38 |
+
--reading_lvl=s_level
|
39 |
+
--out_file=<output_csv>
|
40 |
+
|
41 |
+
# manual specification of operations (no planner)
|
42 |
+
python plan_simp/scripts/generate.py inference
|
43 |
+
--model_ckpt=<simplification_model> # e.g. liamcripwell/pgdyn-simp
|
44 |
+
--test_file=<test_sentences>
|
45 |
+
--op_col=label
|
46 |
+
--reading_lvl=s_level
|
47 |
+
--out_file=<output_csv>
|
48 |
+
```
|