wbi-sg commited on
Commit
cd8c15d
1 Parent(s): 920d7c6

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +53 -0
  2. pytorch_model.bin +3 -0
README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - flair
4
+ - entity-mention-linker
5
+ ---
6
+
7
+ ## bioasyn-sapbert-bc2gn-gene
8
+
9
+ Biomedical Entity Mention Linking for gene:
10
+
11
+ - Model: [dmis-lab/biosyn-sapbert-bc2gn](https://huggingface.co/dmis-lab/biosyn-sapbert-bc2gn)
12
+ - Dictionary: [NCBI Gene (Human)](https://ftp.ncbi.nih.gov/gene/DATA/GENE_INFO/Mammalia/Homo_sapiens.gene_info.gz)
13
+
14
+ ### Demo: How to use in Flair
15
+
16
+ Requires:
17
+
18
+ - **[Flair](https://github.com/flairNLP/flair/)>=0.14.0** (`pip install flair` or `pip install git+https://github.com/flairNLP/flair.git`)
19
+
20
+ ```python
21
+ from flair.data import Sentence
22
+ from flair.models import Classifier, EntityMentionLinker
23
+ from flair.tokenization import SciSpacyTokenizer
24
+
25
+ sentence = Sentence(
26
+ "The mutation in the ABCD1 gene causes X-linked adrenoleukodystrophy, "
27
+ "a neurodegenerative disease, which is exacerbated by exposure to high "
28
+ "levels of mercury in dolphin populations.",
29
+ use_tokenizer=SciSpacyTokenizer()
30
+ )
31
+
32
+ # load hunflair to detect the entity mentions we want to link.
33
+ tagger = Classifier.load("hunflair-gene")
34
+ tagger.predict(sentence)
35
+
36
+ # load the linker and dictionary
37
+ linker = EntityMentionLinker.load("gene-linker")
38
+ linker.predict(sentence)
39
+
40
+ # print the results for each entity mention:
41
+ for span in sentence.get_spans(tagger.label_type):
42
+ for link in span.get_labels(linker.label_type):
43
+ print(f"{span.text} -> {link.value}")
44
+ ```
45
+
46
+ As an alternative to downloading the already precomputed model (much storage). You can also build the model
47
+ and compute the embeddings for the dataset using:
48
+
49
+ ```python
50
+ linker = EntityMentionLinker.build("dmis-lab/biosyn-sapbert-bc2gn", dictionary_name_or_path="ncbi-gene", hybrid_search=False)
51
+ ```
52
+
53
+ This will reduce the download requirements, at the cost of computation.
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d6ae91763ccedf9219c013f00b7da1449cac511f0da45d7f484e3417d59d4fd
3
+ size 5433557743