forked from clarkkev/deep-coref
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_all.py
58 lines (48 loc) · 1.81 KB
/
run_all.py
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
import directories
import build_dataset
import preprocessing
import clustering_preprocessing
import clustering_learning
import pairwise_learning
import model_properties
import timer
import document
from document import Document
def setup():
preprocessing.main()
build_dataset.build_datasets(reduced=True)
build_dataset.build_datasets(reduced=False)
document.main()
def main(model_props=None, cluster_props=None):
if model_props is None:
model_props = model_properties.MentionRankingProps()
if cluster_props is None:
cluster_props = model_properties.ClusterRankingProps()
directories.set_model_name('classification')
model_props.load_weights_from = None
model_props.set_mode('classification')
pairwise_learning.main(model_props=model_props, n_epochs=150)
directories.set_model_name('top_pairs')
model_props.set_mode('top_pairs')
model_props.load_weights_from = 'classification'
model_props.weights_file = 'weights_140'
timer.clear()
pairwise_learning.main(model_props=model_props, n_epochs=50)
directories.set_model_name('ranking')
model_props.set_mode('ranking')
model_props.load_weights_from = 'top_pairs'
model_props.weights_file = 'weights_40'
timer.clear()
pairwise_learning.main(model_props=model_props, n_epochs=50)
model_props.load_weights_from = 'ranking'
pairwise_learning.main(model_props=model_props, write_scores=True, test_only=True)
pairwise_learning.main(model_props=model_props, write_scores=True, test_only=True,
validate="test")
clustering_preprocessing.main('ranking')
cluster_props.load_weights_from = 'ranking'
cluster_props.weights_file = 'weights_40'
timer.celar()
clustering_learning.main(cluster_props)
if __name__ == '__main__':
setup()
main()