Skip to content
Snippets Groups Projects
Commit 6cb47426 authored by laura.riviere's avatar laura.riviere
Browse files

add eval as option

parent 9544fd95
No related branches found
No related tags found
1 merge request!5Archi doc
{ {
"usecase_description": "Config file for usecase_1 : from a raw text, get the same text but with EDU bracket.", "usecase_description": "Config file for usecase_1 : from a tokenized text, get the same text but with EDU bracket.",
"data_raw": { "data_raw": {
"name": "edgar_poe_en", "name": "edgar_poe_short",
"exte": ".txt", "exte": ".conll",
"language": "en", "language": "en",
"existing_metadata": true "existing_metadata": true
}, },
"steps":{ "steps":{
"main": "annotation", "main": "annotation",
"pre-processing": { "pre-processing": {
"to_do": true, "to_do": false,
"syntactic_tool": "stanza", "syntactic_tool": "stanza",
"sentence_split": true, "sentence_split": true,
"tokenization": true, "tokenization": true,
"syntactic_parsing": false, "syntactic_parsing": true,
"create_metadata": { "create_metadata": {
"to_do": true, "to_do": true,
"line": "paragraph", "line": "paragraph",
...@@ -30,16 +30,17 @@ ...@@ -30,16 +30,17 @@
"validation_data_path": null "validation_data_path": null
} }
}, },
"evaluation": true,
"gold_test_data_path": null "gold_test_data_path": null
}, },
"output":{ "output":{
"conll_file":{ "conll_file":{
"to_do": true, "to_do": true,
"metadata": true, "metadata": true,
"with_gold_labels": false "with_gold_labels": true
}, },
"txt_file":{ "txt_file":{
"to_do": false, "to_do": true,
"metadata": true "metadata": true
} }
} }
......
{
"usecase_description": "Config file for usecase_1 : from a tokenized text, get the same text but with EDU bracket.",
"data_raw": {
"name": "edgar_poe_short",
"exte": ".conll",
"language": "en",
"existing_metadata": true
},
"steps":{
"main": "annotation",
"pre-processing": {
"to_do": false,
"syntactic_tool": "stanza",
"sentence_split": true,
"tokenization": true,
"syntactic_parsing": true,
"create_metadata": {
"to_do": true,
"line": "paragraph",
"sent": "sent"
}
},
"discourse_segmenter": {
"model": "/home/lriviere/andiamo/discut/Results_conllu/results_eng.rst.gum-eng_bert/model.tar.gz",
"training": {
"toolkit": null,
"pre_trained_lm": null,
"config_file": null,
"train_data_path": null,
"validation_data_path": null
}
},
"gold_test_data_path": null
},
"output":{
"conll_file":{
"to_do": true,
"metadata": true,
"with_gold_labels": true
},
"txt_file":{
"to_do": true,
"metadata": true
}
}
}
{
"usecase_description": "Config file for usecase_2 : from a gold text, make predictions with an existing model, compare gold and predictions with metrics.",
"data_raw": {
"name": "eng.pdtb.pdtb_dev",
"exte": ".conllu",
"language": "en",
"existing_metadata": true
},
"steps":{
"main": "test",
"pre-processing": {
"to_do": false,
"syntactic_tool": "stanza",
"sentence_split": true,
"tokenization": true,
"syntactic_parsing": true,
"create_metadata": {
"to_do": true,
"line": "paragraph",
"sent": "sent"
}
},
"discourse_segmenter": {
"model": "/home/lriviere/andiamo/morteza/discut/Results_conllu/results_eng.pdtb.pdtb_bert/model.tar.gz",
"training": {
"toolkit": null,
"pre_trained_lm": null,
"config_file": null,
"train_data_path": null,
"validation_data_path": null
}
},
"gold_test_data_path": null
},
"output":{
"conll_file":{
"to_do": true,
"metadata": true,
"with_gold_labels": true
},
"txt_file":{
"to_do": true,
"metadata": true
}
}
}
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
"validation_data_path": "eng.rst.rstdt_dev" "validation_data_path": "eng.rst.rstdt_dev"
} }
}, },
"evaluation": true,
"gold_test_data_path": "eng.rst.rstdt_dev" "gold_test_data_path": "eng.rst.rstdt_dev"
}, },
"output":{ "output":{
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
"validation_data_path": "/home/lriviere/andiamo/discut22/data/eng.sdrt.stac/eng.sdrt.stac_dev.conllu" "validation_data_path": "/home/lriviere/andiamo/discut22/data/eng.sdrt.stac/eng.sdrt.stac_dev.conllu"
} }
}, },
"evaluation": true,
"gold_test_data_path": "eng.rst.rstdt_dev" "gold_test_data_path": "eng.rst.rstdt_dev"
}, },
"output":{ "output":{
......
...@@ -248,6 +248,7 @@ class Process: ...@@ -248,6 +248,7 @@ class Process:
self.crea_meta = infos['pre-processing']['create_metadata']['to_do'] self.crea_meta = infos['pre-processing']['create_metadata']['to_do']
self.meta_line = infos['pre-processing']['create_metadata']['line'] self.meta_line = infos['pre-processing']['create_metadata']['line']
self.meta_sent = infos['pre-processing']['create_metadata']['sent'] self.meta_sent = infos['pre-processing']['create_metadata']['sent']
self.eval = infos['evaluation']
if self.main == "train" or "fine_tune": if self.main == "train" or "fine_tune":
self.set_train = infos['discourse_segmenter']['training']['train_data_path'] self.set_train = infos['discourse_segmenter']['training']['train_data_path']
...@@ -261,11 +262,6 @@ class Process: ...@@ -261,11 +262,6 @@ class Process:
self.model = infos['discourse_segmenter']['model'] # ezpz for Tony self.model = infos['discourse_segmenter']['model'] # ezpz for Tony
self.test_data = infos['gold_test_data_path'] self.test_data = infos['gold_test_data_path']
def get_evaluation_status(self):
if self.main == "test" or self.main == "train" or self.main == "fine_tune":
self.eval = True
else:
self.eval = False # "annotation"
def get_model(self): def get_model(self):
self.model_path = "" self.model_path = ""
...@@ -397,7 +393,6 @@ if __name__ == '__main__': ...@@ -397,7 +393,6 @@ if __name__ == '__main__':
data.make_ner_format() data.make_ner_format()
steps.get_model() steps.get_model()
data.make_predictions(steps) # output allennlp JSON data.make_predictions(steps) # output allennlp JSON
steps.get_evaluation_status()
if steps.eval == True: if steps.eval == True:
data.evaluation(steps, prod) data.evaluation(steps, prod)
else: else:
...@@ -410,7 +405,6 @@ if __name__ == '__main__': ...@@ -410,7 +405,6 @@ if __name__ == '__main__':
steps.update_training_config() steps.update_training_config()
steps.training(data) steps.training(data)
data.make_predictions(steps, js_name=steps.set_test, fi_ner=steps.test_ner) data.make_predictions(steps, js_name=steps.set_test, fi_ner=steps.test_ner)
steps.get_evaluation_status()
if steps.eval == True: if steps.eval == True:
data.evaluation(steps, prod, name=steps.test_data) data.evaluation(steps, prod, name=steps.test_data)
...@@ -422,7 +416,6 @@ if __name__ == '__main__': ...@@ -422,7 +416,6 @@ if __name__ == '__main__':
steps.update_training_config() steps.update_training_config()
steps.fine_tuning(data) steps.fine_tuning(data)
data.make_predictions(steps, js_name=steps.set_test, fi_ner=steps.test_ner, model=steps.model_ft_path) data.make_predictions(steps, js_name=steps.set_test, fi_ner=steps.test_ner, model=steps.model_ft_path)
steps.get_evaluation_status()
if steps.eval == True: if steps.eval == True:
data.evaluation(steps, prod, name=steps.test_data, model=steps.model_ft_path) data.evaluation(steps, prod, name=steps.test_data, model=steps.model_ft_path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment