Skip to content

Commit 67cf028

Browse files
thomaslim6793bgyori
authored andcommitted
add logs to print the local paths of the models
1 parent 2f83544 commit 67cf028

File tree

1 file changed

+7
-3
lines changed
  • indra/sources/indra_bert

1 file changed

+7
-3
lines changed

indra/sources/indra_bert/api.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
__all__ = ['process_text']
22

33
import os
4+
from tqdm import tqdm
45
import logging
56

67
logger = logging.getLogger(__name__)
@@ -37,6 +38,9 @@ def create_extractor(
3738
role_model_path="thomaslim6793/indra_bert_indra_stmt_agents_role_assigner",
3839
stmt_conf_threshold=stmt_conf_threshold
3940
)
41+
logger.info(f"Loaded ner_model from: {ise.ner_model_local_path}")
42+
logger.info(f"Loaded stmt_model from: {ise.stmt_model_local_path}")
43+
logger.info(f"Loaded role_model from: {ise.role_model_local_path}")
4044
return ise
4145

4246
def process_text(text,
@@ -53,7 +57,7 @@ def process_text(text,
5357
)
5458
res = ise.extract_structured_statements_batch(text)
5559
ip = IndraBertProcessor(res, grounder=grounder)
56-
return ip
60+
return ip, ise
5761

5862
def process_texts(texts,
5963
ner_model_path="thomaslim6793/indra_bert_ner_agent_detection",
@@ -73,8 +77,8 @@ def process_texts(texts,
7377
)
7478

7579
ips = []
76-
for text in texts:
80+
for text in tqdm(texts, desc="Processing texts"):
7781
res = ise.extract_structured_statements_batch(text)
7882
ip = IndraBertProcessor(res, grounder=grounder)
7983
ips.append(ip)
80-
return ips
84+
return ips, ise

0 commit comments

Comments
 (0)