Entity linking
State: closed | Pull request: yes

This pull request adds an entity linking model, dataset, loss, example training code, and demo notebook based on the paper "Self-Alignment Pretraining for Biomedical Entity Representations"

You can run through the notebook tutorial or run everything on the command line.

To run everything on the command line follow these steps

1) Download the UMLS datset file `MRCONSO.RRF` from the NIH website and place it in the `examples/nlp/entity_linking/data` directory.

2) Run the following commands from the `examples/nlp/entity_linking` directory
```
python data/umls_dataset_processing.py
python self_alignment_pretraining.py project_dir=. 
python data/umls_dataset_processing.py --index
python build_index.py --restore
python query_index.py --restore
```
The model will take ~24hrs to train on two GPUs and ~48hrs to train on one GPU. By default the project directory will be "." but can be changed by adding the flag `--project_dir=<PATH>` after each of the above commands and changing `project_dir=<PATH>` in the `self_alignment_pretraining.py` command.

This pull request **introduces 18 alerts** when merging ed2b68b7bc10a626a2ae82fb0cbcc0e3f83a456c into 52121810b428e011666e656d313b42c954def26b - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-8fbe4d26b21589a2bf3447334aae25b590af73e0)

**new alerts:**

* 16 for Unused import
* 1 for Redundant assignment
* 1 for Wrong number of arguments in a call

This pull request **introduces 18 alerts** when merging d2e88876defc4ed63869d6039c56dda0608ce3de into 6a3753b3013dc92a3587853d60c5086e2e64d98f - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-c3536e429970831dfc99cb496ffa96fb4a00429a)

**new alerts:**

* 16 for Unused import
* 1 for Redundant assignment
* 1 for Wrong number of arguments in a call

This pull request **introduces 18 alerts** when merging 317ea4f076e29e3b908e1a3dd607ae2cb7b1f0f1 into 6a3753b3013dc92a3587853d60c5086e2e64d98f - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-94e5609abbf38db7fee58e2c7d92bf7bc3f431f3)

**new alerts:**

* 16 for Unused import
* 1 for Redundant assignment
* 1 for Wrong number of arguments in a call

This pull request **introduces 2 alerts** when merging 11416e6697e79ce9f2b56103e89d6ac46b4ec1b5 into 6a3753b3013dc92a3587853d60c5086e2e64d98f - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-150f56213661189bb9ce76917fae1a37eaba1abf)

**new alerts:**

* 2 for Unused import

This pull request **introduces 2 alerts** when merging 84e4ef4b4942977db7663f57e3f4cb823d7c508e into 6a3753b3013dc92a3587853d60c5086e2e64d98f - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-475e98e26e811f2d7bdf5842b5c7b5eb9c0ada8b)

**new alerts:**

* 2 for Unused import

This pull request **introduces 1 alert** when merging 7fac138aab27c318fe8d641cff936de277d217ab into 400632a229d35e42d6a29f398fd16bea11fb897d - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-09217f2d0ec0910ce5c7a80b1e0e68d7f9174ae8)

**new alerts:**

* 1 for Syntax error

This pull request **introduces 1 alert** when merging cb2deb82ce521026af4153e2054f4f523c6a124e into 400632a229d35e42d6a29f398fd16bea11fb897d - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-e22828d3e8eb3af5882eab32e7fc78395443e272)

**new alerts:**

* 1 for Syntax error

This pull request **introduces 2 alerts** when merging 7e8ea27f55293f169fe43b8967cd34cbfb0437ff into 6ce670b7ab3ab5c84ce388fa1968748cd859b8f8 - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-80b46b15d87dfaed714c65d36a615d5bc2bd9283)

**new alerts:**

* 2 for Unused import

This pull request **introduces 2 alerts** when merging a942bfc42f3dee060fb576fbba95de8b9a0d25de into 6ce670b7ab3ab5c84ce388fa1968748cd859b8f8 - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-95a7925bf90f3ea3fb6201b277158573954c658d)

**new alerts:**

* 2 for Unused import

This pull request **introduces 2 alerts** when merging 7a649b5a4ba8db70b6b801f42e473e0ecb44bba3 into a806e044c6a1c583ea14caec7b219241c6924fa5 - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-6e4add3d9214ec7d6ad6374c4e2f31d38f50a274)

**new alerts:**

* 2 for Unused import

This pull request **introduces 2 alerts** when merging 79db128ea469a01f57a6807679c47a8d5bba32e5 into bf9f9ec29e1add0548e40f8b62d100f5e49f1b57 - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-20d989a5d893f8743fd18d9ef8b88fee072e5f45)

**new alerts:**

* 2 for Unused import

This pull request **introduces 2 alerts** when merging 26d25571bdd3b51b6e6f93023e82511efb2195c8 into d017cfcd16e4eb714b9188ccf4df2a8fc69471b7 - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-72194d9c524383e779cbfbddd9aca9a06ca3fef6)

**new alerts:**

* 2 for Unused import

This pull request **introduces 2 alerts** when merging 39f300fe2c7dc13e43fd70bf8d5a04bee4fce01f into 26e5d3a9b3cc934db0004b1dd9263fb7bce9a964 - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-f88c4f49aed8af7aa9bd7fcfd1cc423a02616413)

**new alerts:**

* 2 for Unused import

This pull request **introduces 2 alerts** when merging a8615668105bf7eee8359382883f0ed387f06028 into 5316f2bcd0e326d336cb35bd8222b00914a5b77f - [view on LGTM.com](https://lgtm.com/projects/g/NVIDIA/NeMo/rev/pr-acb4c73634f3755b2f7f76c4fecd143ce88cf349)

**new alerts:**

* 2 for Unused import