From b6ffc7b9a0daa0a2cf100c50c9a3ac171ba158e3 Mon Sep 17 00:00:00 2001 From: "Julien B." <xm9q8f80@jlnbrtn.me> Date: Sun, 25 Aug 2024 22:09:52 +0200 Subject: [PATCH] fix(inferer): fix missing var --- microservices/inferer/inferer.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/microservices/inferer/inferer.py b/microservices/inferer/inferer.py index 2853ba8..1538c65 100644 --- a/microservices/inferer/inferer.py +++ b/microservices/inferer/inferer.py @@ -114,6 +114,13 @@ def inference_process(inference_data, model_id): attentions=outputs.attentions, ) + tag2id = {'action': 1, 'actor': 2, 'artifact': 3, 'condition': 4, 'location': 5, 'modality': 6, 'reference': 7, + 'time': 8} + label2id = { + 'O': 0, + **{f'{k}': v for k, v in tag2id.items()} + } + id2label = {v: k for k, v in label2id.items()} model = RobertaForSpanCategorization.from_pretrained(model_id) tokenizer = AutoTokenizer.from_pretrained(model_id) -- GitLab