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

fix "multi process" pb

parent 5330bb9c
Branches main
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ import utils.json2conll as json_to_connl # TODO clean it
import utils.training_allennlp as tr_allen
import utils.conll2bracket as c2bracket
import utils.seg_eval as seg_eval
import subprocess
......@@ -116,7 +117,12 @@ class Data:
self.pred_json = f"{self.resu}/{js_name}_pred.json"
cmd = f"allennlp predict --use-dataset-reader --output-file {self.pred_json} {model} {fi_ner} &> {self.resu}/logs_predictions.txt"
print(f"----> Making predictions: {cmd}.")
os.system(cmd)
cp = subprocess.run(cmd, shell=True, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print(f"----> done")
with open(f"{self.resu}/logs_predictions.txt", "w") as fe:
fe.write(cp.stderr)
logs.add_infos('predictions_cmd', cmd)
def pred_json_to_conll_w_metadata_w_gold(self, name=None): # here and 3 below..sorry..factorsation TBD
......@@ -268,7 +274,7 @@ class Process:
if self.model == "tony":
arch = "french_tokens.tar.gz"
if not os.path.isfile(f"../model/tony/{arch}"):
dl = "wget https://zenodo.org/record/4235850/files/french_tokens.tar.gz -P ../model --progress=bar"
dl = "wget https://zenodo.org/record/4235850/files/french_tokens.tar.gz -P ../model/tony --progress=bar"
os.system(dl)
self.model_path = f"../model/tony/{arch}"
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment