dki-lab / GrailQA

Apache License 2.0
102 stars 17 forks source link

No 'model_config.json' file for BERT_NER #9

Closed yhshu closed 2 years ago

yhshu commented 3 years ago

Hi there, when I was running main function of bert_entity_linker, I got this message.

File "/home2/yhshu/.pycharm_helpers/pydev/pydevd.py", line 1483, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home2/yhshu/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home2/yhshu/yhshu/workspace/GrailQA/entity_linker/bert_entity_linker.py", line 135, in <module>
python-BaseException
    entity_linker = BertEntityLinker(surface_index, model_path="/BERT_NER/out_base_gq/", device="cuda:6")
  File "/home2/yhshu/yhshu/workspace/GrailQA/entity_linker/bert_entity_linker.py", line 32, in __init__
    self._model = Ner(path + model_path, device)
  File "/home2/yhshu/yhshu/workspace/GrailQA/entity_linker/BERT_NER/bert.py", line 36, in __init__
    self.model, self.tokenizer, self.model_config = self.load_model(model_dir)
  File "/home2/yhshu/yhshu/workspace/GrailQA/entity_linker/BERT_NER/bert.py", line 47, in load_model
    model_config = json.load(open(model_config))
FileNotFoundError: [Errno 2] No such file or directory: '/home2/yhshu/yhshu/workspace/GrailQA/entity_linker/BERT_NER/out_base_gq/model_config.json'

I noticed that there's no file called model_config.json in out_base_gq directory. May I know if I executed this function incorrectly or I need to get this file in some way?

entslscheia commented 3 years ago

Hi, I think it is a typo here. Replacing out_base_gq with trained_ner_model should be fine, because the file you downloaded is actually named as trained_ner_model rather than out_base_gq. I will fix it in my code.

yhshu commented 3 years ago

Thanks for your information.

yhshu commented 3 years ago

I also noticed that there's a lot of aaqu in codes. But is it aqqu?

entslscheia commented 3 years ago

I also noticed that there's a lot of aaqu in codes. But is it aqqu?

Yeah, for the entity disambiguation part I reuse some code from aaqu to construct the index for quick indexing, but it is not the same as aaqu because the performance of aaqu is very low on our dataset, so I turned to use a BERT-based NER model.

yhshu commented 3 years ago

I also noticed that there's a lot of aaqu in codes. But is it aqqu?

Yeah, for the entity disambiguation part I reuse some code from aaqu to construct the index for quick indexing, but it is not the same as aaqu because the performance of aaqu is very low on our dataset, so I turned to use a BERT-based NER model.

Understood. Actually, what I was referring to was a small mistake in the code, i.e., a typo, the name of the entity linker is aqqu instead of aaqu?

yhshu commented 3 years ago

BTW, may I know that how does the effect of google entity link API compares with FACC1? Thanks.

entslscheia commented 2 years ago

BTW, may I know that how does the effect of google entity link API compares with FACC1? Thanks.

Sorry for the late response! I just saw your reply... I actually tried the google knowledge graph API for entity linking because I noticed that Freebase API was actually a de facto choice for entity linking in many previous works before it was down. I do not have the precise numbers for the performance using google knowledge graph API, but I can tell it was not good, and that's why I turned to use the FACC1 scores. My wild guess is that knowledge graph API integrates more sources of information other than Freebase and therefore makes it more noisy. Hope my answer can be helpful. Happy Chinese new year!

yhshu commented 2 years ago

I agree with the preliminary conclusion that Google API may not achieve the FACC1 performance according to my previous experiments. Thanks and happy Chinese New Year.