File size: 1,710 Bytes
834f1f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Linking Actions

This folder contains information regarding the linking actions task.

### Requirements

Implemented with Python 3.7, using the following libraries:

```
tqdm
torch==1.7.0
transformers
numpy
```

### Data

Find the necessary data files in the ```data``` folder.

Linking actions task follows the data format formulated by [Show Me More Details: Discovering Hierarchies of Procedures from Semi-structured Web Data](https://github.com/shuyanzhou/wikihow_hierarchy).

```data/wikihow.json```: wikiHow dump in a single .json file.
```data/hyperlinks.json```: Ground-truth data for goal - step matches, obtained from wikiHow.
```data/step2goal.json```: Each step from the wikiHow dumped, matched with the goal of its tutorial.

Please refer to [Show Me More Details: Discovering Hierarchies of Procedures from Semi-structured Web Data](https://github.com/shuyanzhou/wikihow_hierarchy) to obtain data files used in training and testing.

### Training and Testing

Training and testing scripts are provided.

For training, simply run the following command:

```
python3 reranking/train.py \
  --train_null \
  --add_goal \
  --use_para_score \
  --model_name MODEL_NAME \
  --context_length 1 \
  --train_file ./data/gold.rerank.org.t30.train.json \
  --dev_file ./data/gold.rerank.org.t30.dev.json \
  --gold_step_goal_para_score ./data/gold.para.base.all.score \
  --save_path OUTPUT_PATH \
  --neg_num 29 --bs 1 \
  --mega_bs 4 --val_bs 1 \
  --min_save_ep 0 \
  --epochs 5
```

For testing, simply run the following command:

```
python3 reranking/inference.py \
  --model_path MODEL_PATH \
  --test_path ./data/all_wikihow_step_t30goals.json \
  --save_path ./data/all.result \
  --no_label
```