facebookresearch / BLINK

Entity Linker solution
MIT License
1.17k stars 231 forks source link

Making BLINK run from code. #35

Closed rishabhjoshi closed 3 years ago

rishabhjoshi commented 4 years ago

Hi

A couple of things to make BLINK work from code: 1) In the example code you provided in the readme, you would have to add "faiss_index" and "index_path" to config because they are required by the load_model in main_dense.py as args. Also add "top_k" as it is required by run. 2) main_dense.run in the sample code provided in readme won't work as it is. It will give "run got multiple values for argument logger". To fix this, remove the keyword "logger=" and just pass None like below:

 _, _, _, _, _, predictions, scores, = main_dense.run(args, None, *models, test_data=data_to_link)

3) If None is passed as logger, then the code in main_dense.py breaks because it is not able to handle a None in the logger keyword. To fix that, add "if logger" above all the lines which involve logger. Eg: Line 369.

if logger:
    logger.info("interactive mode")

4) crossencoder/train_cross.py also does not handle None values for logger.

It would be great if these could be fixed. Really useful tool! Thanks Rishabh Joshi

rishabhjoshi commented 4 years ago

Let me know if you need me to send in a PR. I'll be happy to help!

ledw commented 3 years ago

@rishabhjoshi The issue is resolved in https://github.com/facebookresearch/BLINK/pull/49. Thanks for offering your help!